This removes api authentification with token in favor of signature method. Refactorize code and clean up. It add more unit test plus code coverage in test/converage. - Added config.api.timestampTimeout - Added Helper::signRequest This calculates the request signature - Added more unit tests and extend code coverage. - Added rate limiter for web routes - Added RemoveSpaces Sanitizer on api requests - Added stress test suite - Changed AuthServiceProvider api-token to api-hmac - Changed CustomerSeeder to have at least of customer activated (for unit tests) - Changed used transation for saveing multiple models - Changed, in ServiceController generateApiToken to generateServicePassword - Changed, timestamp has to be send in request with a DateTime format, it also has to a UTC value - Composer added brianium/paratest - Composer update - Fixed case where removing single optin could be the wrong one (not for the good service) - Fixed customer delete - Fixed customer would not be resolved by brand. - Fixed Really check that request is json checking body content, preventing sending malformed requests - Remove ApiError::needAuth - Removed api_token - Removed ApiController::authenticate - Removed config.api.tokenTimeout - Removed Header check or usage because of HAProxy doing weird stuff - Removed lock files from gitignore - Removed memcached dependency - Removed unused questions resources api routes - Removed workspace file Migrations - Added unique index on services.bearer_token - Changed customer_id on customer_answer is nullable - Changed services.bearer_pwd length to 312 (the size of the token) - Dropped services.api_token and service.api_token_date
309 lines
16 KiB
HTML
309 lines
16 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Dashboard for /home/jeremy/projets/crm/app/Models</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<link href="../_css/bootstrap.min.css" rel="stylesheet" type="text/css">
|
|
<link href="../_css/nv.d3.min.css" rel="stylesheet" type="text/css">
|
|
<link href="../_css/style.css" rel="stylesheet" type="text/css">
|
|
<link href="../_css/custom.css" rel="stylesheet" type="text/css">
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<nav aria-label="breadcrumb">
|
|
<ol class="breadcrumb">
|
|
<li class="breadcrumb-item"><a href="../index.html">/home/jeremy/projets/crm/app</a></li>
|
|
<li class="breadcrumb-item"><a href="index.html">Models</a></li>
|
|
<li class="breadcrumb-item active">(Dashboard)</li>
|
|
|
|
</ol>
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<h2>Classes</h2>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<h3>Coverage Distribution</h3>
|
|
<div id="classCoverageDistribution" style="height: 300px;">
|
|
<svg></svg>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<h3>Complexity</h3>
|
|
<div id="classComplexity" style="height: 300px;">
|
|
<svg></svg>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<h3>Insufficient Coverage</h3>
|
|
<div class="scrollbox">
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Class</th>
|
|
<th class="text-right">Coverage</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr><td><a href="BrandStat.php.html#8">App\Models\BrandStat</a></td><td class="text-right">50%</td></tr>
|
|
<tr><td><a href="Brand.php.html#13">App\Models\Brand</a></td><td class="text-right">71%</td></tr>
|
|
<tr><td><a href="SingleOptin.php.html#12">App\Models\SingleOptin</a></td><td class="text-right">79%</td></tr>
|
|
<tr><td><a href="Service.php.html#20">App\Models\Service</a></td><td class="text-right">80%</td></tr>
|
|
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<h3>Project Risks</h3>
|
|
<div class="scrollbox">
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Class</th>
|
|
<th class="text-right"><abbr title="Change Risk Anti-Patterns (CRAP) Index">CRAP</abbr></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr><td><a href="Service.php.html#20">App\Models\Service</a></td><td class="text-right">15</td></tr>
|
|
<tr><td><a href="SingleOptin.php.html#12">App\Models\SingleOptin</a></td><td class="text-right">4</td></tr>
|
|
<tr><td><a href="BrandStat.php.html#8">App\Models\BrandStat</a></td><td class="text-right">4</td></tr>
|
|
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<h2>Methods</h2>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<h3>Coverage Distribution</h3>
|
|
<div id="methodCoverageDistribution" style="height: 300px;">
|
|
<svg></svg>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<h3>Complexity</h3>
|
|
<div id="methodComplexity" style="height: 300px;">
|
|
<svg></svg>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<h3>Insufficient Coverage</h3>
|
|
<div class="scrollbox">
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Method</th>
|
|
<th class="text-right">Coverage</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr><td><a href="Brand.php.html#132"><abbr title="App\Models\Brand::customerInfos">customerInfos</abbr></a></td><td class="text-right">0%</td></tr>
|
|
<tr><td><a href="Brand.php.html#142"><abbr title="App\Models\Brand::servicesStats">servicesStats</abbr></a></td><td class="text-right">0%</td></tr>
|
|
<tr><td><a href="Brand.php.html#152"><abbr title="App\Models\Brand::singleOptins">singleOptins</abbr></a></td><td class="text-right">0%</td></tr>
|
|
<tr><td><a href="Brand.php.html#164"><abbr title="App\Models\Brand::getAccountsAttribute">getAccountsAttribute</abbr></a></td><td class="text-right">0%</td></tr>
|
|
<tr><td><a href="Brand.php.html#174"><abbr title="App\Models\Brand::getTotalOptinsAttribute">getTotalOptinsAttribute</abbr></a></td><td class="text-right">0%</td></tr>
|
|
<tr><td><a href="BrandStat.php.html#58"><abbr title="App\Models\BrandStat::brand">brand</abbr></a></td><td class="text-right">0%</td></tr>
|
|
<tr><td><a href="CustomerInfo.php.html#88"><abbr title="App\Models\CustomerInfo::login">login</abbr></a></td><td class="text-right">0%</td></tr>
|
|
<tr><td><a href="Service.php.html#144"><abbr title="App\Models\Service::servicesStats">servicesStats</abbr></a></td><td class="text-right">0%</td></tr>
|
|
<tr><td><a href="Service.php.html#156"><abbr title="App\Models\Service::generateBearerToken">generateBearerToken</abbr></a></td><td class="text-right">0%</td></tr>
|
|
<tr><td><a href="Service.php.html#170"><abbr title="App\Models\Service::generateBearerPassword">generateBearerPassword</abbr></a></td><td class="text-right">0%</td></tr>
|
|
<tr><td><a href="BrandStat.php.html#42"><abbr title="App\Models\BrandStat::booted">booted</abbr></a></td><td class="text-right">60%</td></tr>
|
|
<tr><td><a href="Service.php.html#107"><abbr title="App\Models\Service::booted">booted</abbr></a></td><td class="text-right">64%</td></tr>
|
|
<tr><td><a href="Brand.php.html#89"><abbr title="App\Models\Brand::booted">booted</abbr></a></td><td class="text-right">70%</td></tr>
|
|
<tr><td><a href="SingleOptin.php.html#37"><abbr title="App\Models\SingleOptin::__construct">__construct</abbr></a></td><td class="text-right">78%</td></tr>
|
|
<tr><td><a href="Customer.php.html#156"><abbr title="App\Models\Customer::loadBrandData">loadBrandData</abbr></a></td><td class="text-right">83%</td></tr>
|
|
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<h3>Project Risks</h3>
|
|
<div class="scrollbox">
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Method</th>
|
|
<th class="text-right"><abbr title="Change Risk Anti-Patterns (CRAP) Index">CRAP</abbr></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr><td><a href="Customer.php.html#156"><abbr title="App\Models\Customer::loadBrandData">loadBrandData</abbr></a></td><td class="text-right">5</td></tr>
|
|
<tr><td><a href="SingleOptin.php.html#37"><abbr title="App\Models\SingleOptin::__construct">__construct</abbr></a></td><td class="text-right">3</td></tr>
|
|
<tr><td><a href="BrandStat.php.html#42"><abbr title="App\Models\BrandStat::booted">booted</abbr></a></td><td class="text-right">2</td></tr>
|
|
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<footer>
|
|
<hr/>
|
|
<p>
|
|
<small>Generated by <a href="https://github.com/sebastianbergmann/php-code-coverage" target="_top">php-code-coverage 9.2.10</a> using <a href="https://secure.php.net/" target="_top">PHP 7.3.31-2+ubuntu20.04.1+deb.sury.org+1</a> and <a href="https://phpunit.de/">PHPUnit 9.5.11</a> at Thu Jan 6 12:10:34 CET 2022.</small>
|
|
</p>
|
|
</footer>
|
|
</div>
|
|
<script src="../_js/jquery.min.js" type="text/javascript"></script>
|
|
<script src="../_js/d3.min.js" type="text/javascript"></script>
|
|
<script src="../_js/nv.d3.min.js" type="text/javascript"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
nv.addGraph(function() {
|
|
var chart = nv.models.multiBarChart();
|
|
chart.tooltips(false)
|
|
.showControls(false)
|
|
.showLegend(false)
|
|
.reduceXTicks(false)
|
|
.staggerLabels(true)
|
|
.yAxis.tickFormat(d3.format('d'));
|
|
|
|
d3.select('#classCoverageDistribution svg')
|
|
.datum(getCoverageDistributionData([0,0,0,0,0,0,1,0,2,1,2,7], "Class Coverage"))
|
|
.transition().duration(500).call(chart);
|
|
|
|
nv.utils.windowResize(chart.update);
|
|
|
|
return chart;
|
|
});
|
|
|
|
nv.addGraph(function() {
|
|
var chart = nv.models.multiBarChart();
|
|
chart.tooltips(false)
|
|
.showControls(false)
|
|
.showLegend(false)
|
|
.reduceXTicks(false)
|
|
.staggerLabels(true)
|
|
.yAxis.tickFormat(d3.format('d'));
|
|
|
|
d3.select('#methodCoverageDistribution svg')
|
|
.datum(getCoverageDistributionData([10,0,0,0,0,0,0,2,2,1,2,39], "Method Coverage"))
|
|
.transition().duration(500).call(chart);
|
|
|
|
nv.utils.windowResize(chart.update);
|
|
|
|
return chart;
|
|
});
|
|
|
|
function getCoverageDistributionData(data, label) {
|
|
var labels = [
|
|
'0%',
|
|
'0-10%',
|
|
'10-20%',
|
|
'20-30%',
|
|
'30-40%',
|
|
'40-50%',
|
|
'50-60%',
|
|
'60-70%',
|
|
'70-80%',
|
|
'80-90%',
|
|
'90-100%',
|
|
'100%'
|
|
];
|
|
var values = [];
|
|
$.each(labels, function(key) {
|
|
values.push({x: labels[key], y: data[key]});
|
|
});
|
|
|
|
return [
|
|
{
|
|
key: label,
|
|
values: values,
|
|
color: "#4572A7"
|
|
}
|
|
];
|
|
}
|
|
nv.addGraph(function() {
|
|
var chart = nv.models.scatterChart()
|
|
.showDistX(true)
|
|
.showDistY(true)
|
|
.showLegend(false)
|
|
.forceX([0, 100]);
|
|
chart.tooltipContent(function(graph) {
|
|
return '<p>' + graph.point.class + '</p>';
|
|
});
|
|
|
|
chart.xAxis.axisLabel('Code Coverage (in percent)');
|
|
chart.yAxis.axisLabel('Cyclomatic Complexity');
|
|
|
|
d3.select('#classComplexity svg')
|
|
.datum(getComplexityData([[100,3,"<a href=\"Answer.php.html#12\">App\\Models\\Answer<\/a>"],[71.42857142857143,10,"<a href=\"Brand.php.html#13\">App\\Models\\Brand<\/a>"],[50,3,"<a href=\"BrandStat.php.html#8\">App\\Models\\BrandStat<\/a>"],[93.22033898305084,24,"<a href=\"Customer.php.html#11\">App\\Models\\Customer<\/a>"],[100,3,"<a href=\"CustomerAnswer.php.html#7\">App\\Models\\CustomerAnswer<\/a>"],[94.73684210526315,5,"<a href=\"CustomerInfo.php.html#11\">App\\Models\\CustomerInfo<\/a>"],[100,6,"<a href=\"CustomerLogin.php.html#9\">App\\Models\\CustomerLogin<\/a>"],[100,2,"<a href=\"CustomerOptInHistory.php.html#8\">App\\Models\\CustomerOptInHistory<\/a>"],[100,3,"<a href=\"Question.php.html#14\">App\\Models\\Question<\/a>"],[80,14,"<a href=\"Service.php.html#20\">App\\Models\\Service<\/a>"],[100,2,"<a href=\"ServiceStat.php.html#8\">App\\Models\\ServiceStat<\/a>"],[79.3103448275862,4,"<a href=\"SingleOptin.php.html#12\">App\\Models\\SingleOptin<\/a>"],[100,0,"<a href=\"User.php.html#9\">App\\Models\\User<\/a>"]], 'Class Complexity'))
|
|
.transition()
|
|
.duration(500)
|
|
.call(chart);
|
|
|
|
nv.utils.windowResize(chart.update);
|
|
|
|
return chart;
|
|
});
|
|
|
|
nv.addGraph(function() {
|
|
var chart = nv.models.scatterChart()
|
|
.showDistX(true)
|
|
.showDistY(true)
|
|
.showLegend(false)
|
|
.forceX([0, 100]);
|
|
chart.tooltipContent(function(graph) {
|
|
return '<p>' + graph.point.class + '</p>';
|
|
});
|
|
|
|
chart.xAxis.axisLabel('Code Coverage (in percent)');
|
|
chart.yAxis.axisLabel('Method Complexity');
|
|
|
|
d3.select('#methodComplexity svg')
|
|
.datum(getComplexityData([[100,1,"<a href=\"Answer.php.html#37\">App\\Models\\Answer::__construct<\/a>"],[100,1,"<a href=\"Answer.php.html#65\">App\\Models\\Answer::question<\/a>"],[100,1,"<a href=\"Answer.php.html#75\">App\\Models\\Answer::customers<\/a>"],[100,1,"<a href=\"Brand.php.html#46\">App\\Models\\Brand::__construct<\/a>"],[100,1,"<a href=\"Brand.php.html#77\">App\\Models\\Brand::getCacheBaseTags<\/a>"],[70,1,"<a href=\"Brand.php.html#89\">App\\Models\\Brand::booted<\/a>"],[100,1,"<a href=\"Brand.php.html#112\">App\\Models\\Brand::services<\/a>"],[100,1,"<a href=\"Brand.php.html#122\">App\\Models\\Brand::questions<\/a>"],[0,1,"<a href=\"Brand.php.html#132\">App\\Models\\Brand::customerInfos<\/a>"],[0,1,"<a href=\"Brand.php.html#142\">App\\Models\\Brand::servicesStats<\/a>"],[0,1,"<a href=\"Brand.php.html#152\">App\\Models\\Brand::singleOptins<\/a>"],[0,1,"<a href=\"Brand.php.html#164\">App\\Models\\Brand::getAccountsAttribute<\/a>"],[0,1,"<a href=\"Brand.php.html#174\">App\\Models\\Brand::getTotalOptinsAttribute<\/a>"],[60,2,"<a href=\"BrandStat.php.html#42\">App\\Models\\BrandStat::booted<\/a>"],[0,1,"<a href=\"BrandStat.php.html#58\">App\\Models\\BrandStat::brand<\/a>"],[100,1,"<a href=\"Customer.php.html#35\">App\\Models\\Customer::infos<\/a>"],[100,1,"<a href=\"Customer.php.html#45\">App\\Models\\Customer::logins<\/a>"],[100,1,"<a href=\"Customer.php.html#55\">App\\Models\\Customer::optInHistory<\/a>"],[100,1,"<a href=\"Customer.php.html#65\">App\\Models\\Customer::brands<\/a>"],[100,1,"<a href=\"Customer.php.html#75\">App\\Models\\Customer::answers<\/a>"],[92.85714285714286,6,"<a href=\"Customer.php.html#91\">App\\Models\\Customer::info<\/a>"],[92.85714285714286,6,"<a href=\"Customer.php.html#124\">App\\Models\\Customer::login<\/a>"],[83.33333333333334,5,"<a href=\"Customer.php.html#156\">App\\Models\\Customer::loadBrandData<\/a>"],[100,1,"<a href=\"Customer.php.html#183\">App\\Models\\Customer::setOptIn<\/a>"],[100,1,"<a href=\"Customer.php.html#202\">App\\Models\\Customer::getAnswers<\/a>"],[100,1,"<a href=\"CustomerAnswer.php.html#15\">App\\Models\\CustomerAnswer::getUpdatedAtColumn<\/a>"],[100,1,"<a href=\"CustomerAnswer.php.html#27\">App\\Models\\CustomerAnswer::customer<\/a>"],[100,1,"<a href=\"CustomerAnswer.php.html#37\">App\\Models\\CustomerAnswer::answer<\/a>"],[100,1,"<a href=\"CustomerInfo.php.html#57\">App\\Models\\CustomerInfo::booted<\/a>"],[100,1,"<a href=\"CustomerInfo.php.html#78\">App\\Models\\CustomerInfo::customer<\/a>"],[0,1,"<a href=\"CustomerInfo.php.html#88\">App\\Models\\CustomerInfo::login<\/a>"],[100,1,"<a href=\"CustomerInfo.php.html#98\">App\\Models\\CustomerInfo::brand<\/a>"],[100,1,"<a href=\"CustomerInfo.php.html#112\">App\\Models\\CustomerInfo::getFromEmail<\/a>"],[100,3,"<a href=\"CustomerLogin.php.html#45\">App\\Models\\CustomerLogin::booted<\/a>"],[100,1,"<a href=\"CustomerLogin.php.html#66\">App\\Models\\CustomerLogin::customer<\/a>"],[100,1,"<a href=\"CustomerLogin.php.html#76\">App\\Models\\CustomerLogin::brand<\/a>"],[100,1,"<a href=\"CustomerLogin.php.html#88\">App\\Models\\CustomerLogin::passwordMatch<\/a>"],[100,1,"<a href=\"CustomerOptInHistory.php.html#26\">App\\Models\\CustomerOptInHistory::customer<\/a>"],[100,1,"<a href=\"CustomerOptInHistory.php.html#36\">App\\Models\\CustomerOptInHistory::brand<\/a>"],[100,1,"<a href=\"Question.php.html#50\">App\\Models\\Question::__construct<\/a>"],[100,1,"<a href=\"Question.php.html#108\">App\\Models\\Question::brand<\/a>"],[100,1,"<a href=\"Question.php.html#118\">App\\Models\\Question::answers<\/a>"],[100,1,"<a href=\"Service.php.html#53\">App\\Models\\Service::__construct<\/a>"],[100,1,"<a href=\"Service.php.html#95\">App\\Models\\Service::getCacheBaseTags<\/a>"],[64.28571428571429,1,"<a href=\"Service.php.html#107\">App\\Models\\Service::booted<\/a>"],[100,1,"<a href=\"Service.php.html#134\">App\\Models\\Service::brand<\/a>"],[0,1,"<a href=\"Service.php.html#144\">App\\Models\\Service::servicesStats<\/a>"],[0,1,"<a href=\"Service.php.html#156\">App\\Models\\Service::generateBearerToken<\/a>"],[0,1,"<a href=\"Service.php.html#170\">App\\Models\\Service::generateBearerPassword<\/a>"],[100,1,"<a href=\"Service.php.html#182\">App\\Models\\Service::incrementStat<\/a>"],[100,5,"<a href=\"Service.php.html#197\">App\\Models\\Service::getFromBearerToken<\/a>"],[100,1,"<a href=\"Service.php.html#254\">App\\Models\\Service::authenticateApi<\/a>"],[100,1,"<a href=\"ServiceStat.php.html#35\">App\\Models\\ServiceStat::brand<\/a>"],[100,1,"<a href=\"ServiceStat.php.html#45\">App\\Models\\ServiceStat::service<\/a>"],[78.57142857142857,3,"<a href=\"SingleOptin.php.html#37\">App\\Models\\SingleOptin::__construct<\/a>"],[100,1,"<a href=\"SingleOptin.php.html#96\">App\\Models\\SingleOptin::brand<\/a>"]], 'Method Complexity'))
|
|
.transition()
|
|
.duration(500)
|
|
.call(chart);
|
|
|
|
nv.utils.windowResize(chart.update);
|
|
|
|
return chart;
|
|
});
|
|
|
|
function getComplexityData(data, label) {
|
|
var values = [];
|
|
$.each(data, function(key) {
|
|
var value = Math.round(data[key][0]*100) / 100;
|
|
values.push({
|
|
x: value,
|
|
y: data[key][1],
|
|
class: data[key][2],
|
|
size: 0.05,
|
|
shape: 'diamond'
|
|
});
|
|
});
|
|
|
|
return [
|
|
{
|
|
key: label,
|
|
values: values,
|
|
color: "#4572A7"
|
|
}
|
|
];
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|