Skip to content

Commit dd80514

Browse files
author
jdlabails
committed
View symfony version
1 parent 00e179d commit dd80514

10 files changed

Lines changed: 199 additions & 157 deletions

File tree

Entities/Analyze.php

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ class Analyze
124124
*/
125125
private $lang;
126126

127+
/**
128+
* @var string
129+
*/
130+
private $symfonyVersion;
131+
127132

128133
/**
129134
* Get id
@@ -374,10 +379,10 @@ public function getExecTime()
374379
public function getReadableExecTime()
375380
{
376381
if ($this->execTime > 120) {
377-
return round($this->execTime / 60, 0, PHP_ROUND_HALF_DOWN).' min '.($this->execTime%60).' sec ';
382+
return round($this->execTime / 60, 0, PHP_ROUND_HALF_DOWN) . ' min ' . ($this->execTime % 60) . ' sec ';
378383
}
379384

380-
return $this->execTime.' sec';
385+
return $this->execTime . ' sec';
381386
}
382387

383388
/**
@@ -388,7 +393,7 @@ public function getReadableExecTime()
388393
*/
389394
public function setNbBundles($nbBundles)
390395
{
391-
$this->nbBundles = (int) $nbBundles;
396+
$this->nbBundles = (int)$nbBundles;
392397

393398
return $this;
394399
}
@@ -411,7 +416,7 @@ public function getNbBundles()
411416
*/
412417
public function setNbDir($nbDir)
413418
{
414-
$this->nbDir = (int) $nbDir;
419+
$this->nbDir = (int)$nbDir;
415420

416421
return $this;
417422
}
@@ -434,7 +439,7 @@ public function getNbDir()
434439
*/
435440
public function setNbFile($nbFile)
436441
{
437-
$this->nbFile = (int) $nbFile;
442+
$this->nbFile = (int)$nbFile;
438443

439444
return $this;
440445
}
@@ -457,7 +462,7 @@ public function getNbFile()
457462
*/
458463
public function setNbPhpFile($nbPhpFile)
459464
{
460-
$this->nbPhpFile = (int) $nbPhpFile;
465+
$this->nbPhpFile = (int)$nbPhpFile;
461466

462467
return $this;
463468
}
@@ -480,7 +485,7 @@ public function getNbPhpFile()
480485
*/
481486
public function setNbCSSFile($nbCSSFile)
482487
{
483-
$this->nbCSSFile = (int) $nbCSSFile;
488+
$this->nbCSSFile = (int)$nbCSSFile;
484489

485490
return $this;
486491
}
@@ -503,7 +508,7 @@ public function getNbCSSFile()
503508
*/
504509
public function setNbCSSLib($nbCSSLib)
505510
{
506-
$this->nbCSSLib = (int) $nbCSSLib;
511+
$this->nbCSSLib = (int)$nbCSSLib;
507512

508513
return $this;
509514
}
@@ -526,7 +531,7 @@ public function getNbCSSLib()
526531
*/
527532
public function setNbJSFile($nbJSFile)
528533
{
529-
$this->nbJSFile = (int) $nbJSFile;
534+
$this->nbJSFile = (int)$nbJSFile;
530535

531536
return $this;
532537
}
@@ -549,7 +554,7 @@ public function getNbJSFile()
549554
*/
550555
public function setNbJSLib($nbJSLib)
551556
{
552-
$this->nbJSLib = (int) $nbJSLib;
557+
$this->nbJSLib = (int)$nbJSLib;
553558

554559
return $this;
555560
}
@@ -572,7 +577,7 @@ public function getNbJSLib()
572577
*/
573578
public function setNbTwig($nbTwig)
574579
{
575-
$this->nbTwig = (int) $nbTwig;
580+
$this->nbTwig = (int)$nbTwig;
576581

577582
return $this;
578583
}
@@ -595,7 +600,7 @@ public function getNbTwig()
595600
*/
596601
public function setNbNamespace($nbNamespace)
597602
{
598-
$this->nbNamespace = (int) $nbNamespace;
603+
$this->nbNamespace = (int)$nbNamespace;
599604

600605
return $this;
601606
}
@@ -618,7 +623,7 @@ public function getNbNamespace()
618623
*/
619624
public function setNbClasses($nbClasses)
620625
{
621-
$this->nbClasses = (int) $nbClasses;
626+
$this->nbClasses = (int)$nbClasses;
622627

623628
return $this;
624629
}
@@ -641,7 +646,7 @@ public function getNbClasses()
641646
*/
642647
public function setNbMethod($nbMethod)
643648
{
644-
$this->nbMethod = (int) $nbMethod;
649+
$this->nbMethod = (int)$nbMethod;
645650

646651
return $this;
647652
}
@@ -690,12 +695,30 @@ public function jsonSerialize()
690695

691696
/**
692697
* Set an Analyse object from an array
693-
* @param type $data
698+
* @param array $data
694699
*/
695700
public function setFromArray($data)
696701
{
697702
foreach ($data as $key => $value) {
698703
$this->{$key} = $value;
699704
}
700705
}
706+
707+
/**
708+
* @return string
709+
*/
710+
public function getSymfonyVersion()
711+
{
712+
return $this->symfonyVersion;
713+
}
714+
715+
/**
716+
* @param string $symfonyVersion
717+
* @return Analyze
718+
*/
719+
public function setSymfonyVersion($symfonyVersion)
720+
{
721+
$this->symfonyVersion = $symfonyVersion;
722+
return $this;
723+
}
701724
}

Manager/ProjectAnalyzer.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public function __construct($configGlobale, TranslatorInterface $translator, $ro
4949
$this->oAnalyze = new Analyze();
5050
$this->oAnalyze
5151
->setLang($translator->getLocale())
52+
->setSymfonyVersion($this->getSymfonyVersion())
5253
->setNbNamespace($this->extractFromLoc('namespaces'))
5354
->setNbClasses($this->extractFromLoc('classes'))
5455
->setNbMethod($this->extractFromLoc('methods'))
@@ -157,6 +158,14 @@ protected function setSecurityInfo()
157158
$this->oAnalyze->setSecuritySuccess($securityAnalyse['SECURITY']['summary'] === 'ok');
158159
}
159160

161+
protected function getSymfonyVersion()
162+
{
163+
$reportFilePath = $this->reportPath.'/SYMFONY/report.txt';
164+
$report = $this->getReport($reportFilePath);
165+
166+
return substr($report[0], 8, 5);
167+
}
168+
160169
/**
161170
* Set info from quality analysis
162171
*/
@@ -302,12 +311,12 @@ protected function exploitTestReport()
302311
}
303312

304313
/**
305-
* Lit les rapports d'analyse
314+
* Read analysis reports
306315
* @return array
307316
*/
308317
public function getReportInfo()
309318
{
310-
$tabReports = array('MD', 'CS', 'CPD', 'DEPEND', 'LOC', 'DOCS', 'SECURITY');
319+
$tabReports = array('MD', 'CS', 'CPD', 'DEPEND', 'LOC', 'DOCS', 'SECURITY', 'SYMFONY');
311320

312321
foreach ($tabReports as $report) {
313322
list($reportTxt, $vide) = $this->getReport($this->reportPath.'/'.$report.'/report.txt');

Manager/ScriptManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function lancerAnalyse()
5858

5959
// si on arrive là on doit lancer l'analyse selon la config
6060
$this->paShPath = $this->shDirPath.'/pa.sh';
61-
$this->creerAnalyses();
61+
$this->createAnalysis();
6262

6363
// lancement unitaire : le sh à lancer n'est pas la meme
6464
if (filter_input(INPUT_POST, 'one') != '') {

Resources/sh/header.tpl.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,8 @@ do
4242
;;
4343
esac
4444
done
45+
46+
47+
echo "Lecture de la version de symfony"
48+
49+
${DIR_BIN}/console --version > ${DIR_REPORT}/SYMFONY/report.txt

Resources/sh/install.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ createDir4Web ${DIR_REPORT}/LOC
4747
createDir4Web ${DIR_REPORT}/DEPEND
4848
createDir4Web ${DIR_REPORT}/DOCS
4949
createDir4Web ${DIR_REPORT}/MD
50+
createDir4Web ${DIR_REPORT}/SYMFONY
5051
createDir4Web ${DIR_REPORT}/TEST
5152
createDir4Web ${DIR_REPORT}/HISTORIQUE
5253
createDir4Web ${DIR_REPORT}/SECURITY

Resources/views/Main/header.html.twig

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,73 +6,78 @@
66
</h1>
77
</div>
88
<div class="col-md-4" style="margin-top:23px; font-size:20px">
9-
<div class="label-{% if projectAnalyzer.analyze.tuSuccess %}success{% else %}danger{%endif%}" id="encartResultat">
9+
<div class="label-{% if projectAnalyzer.analyze.tuSuccess %}success{% else %}danger{% endif %}" id="encartResultat">
1010
<table>
1111
<tr>
12-
<td>{% trans %}lastAnalyze{%endtrans%}</td>
12+
<td>{% trans %}lastAnalyze{% endtrans %}</td>
1313
<td>{{ projectAnalyzer.analyze.readableDateTime }}</td>
1414
</tr>
1515
<tr>
16-
<td>{% trans %}duration{%endtrans %}</td>
16+
<td>{% trans %}duration{% endtrans %}</td>
1717
<td>{{ projectAnalyzer.analyze.readableExecTime }}</td>
1818
</tr>
1919
{% if projectAnalyzer.isScoreEnable %}
20-
<tr>
21-
<td>{% trans %}score.note{%endtrans %}</td>
22-
<td {% if projectAnalyzer.analyze.getReadableDateTime() != projectAnalyzer.testInfo['dateTimeCC'] and projectAnalyzer.analyze.getTuSuccess() %} style="color: red;font-weight: normal" {% endif %} >
23-
{{ projectAnalyzer.analyze.score }} / 20
24-
<img
25-
src="{{ asset('bundles/jdphpprojectanalyzer/img/question.png') }}"
26-
class="help"
27-
data-toggle="popover"
28-
data-trigger="focus"
29-
data-placement="left"
30-
tabindex="0"
31-
style="margin-left: 20px"
32-
title="{% trans %}score.popTitle{%endtrans %}"
33-
data-content="
34-
{% trans %}score.popContent.begin{%endtrans %}
20+
<tr>
21+
<td>{% trans %}score.note{% endtrans %}</td>
22+
<td {% if projectAnalyzer.analyze.getReadableDateTime() != projectAnalyzer.testInfo['dateTimeCC'] and projectAnalyzer.analyze.getTuSuccess() %} style="color: red;font-weight: normal" {% endif %} >
23+
{{ projectAnalyzer.analyze.score }} / 20
24+
<img
25+
src="{{ asset('bundles/jdphpprojectanalyzer/img/question.png') }}"
26+
class="help"
27+
data-toggle="popover"
28+
data-trigger="focus"
29+
data-placement="left"
30+
tabindex="0"
31+
style="margin-left: 20px"
32+
title="{% trans %}score.popTitle{% endtrans %}"
33+
data-content="
34+
{% trans %}score.popContent.begin{% endtrans %}
3535
3636
<ul>
3737
<li>Code Sniffer score</li>
3838
<li>Copy paste score</li>
3939
<li>Security checker score</li>
4040
<li>Tests status x code coverage</li>
41-
<li>{% trans %}score.popContent.sizeProject{%endtrans %}</li>
41+
<li>{% trans %}score.popContent.sizeProject{% endtrans %}</li>
4242
</ul>
43-
{% trans %}score.popContent.fitWeighting{%endtrans %}
43+
{% trans %}score.popContent.fitWeighting{% endtrans %}
4444
<hr>
45-
{% trans %}score.popContent.currentSet{%endtrans %}
45+
{% trans %}score.popContent.currentSet{% endtrans %}
4646
<ul>
4747
<li>
48-
{% trans %}score.popContent.csWeight{%endtrans %} :
49-
{{ projectAnalyzer.getScoreWeightParam('csWeight')}}
48+
{% trans %}score.popContent.csWeight{% endtrans %} :
49+
{{ projectAnalyzer.getScoreWeightParam('csWeight') }}
5050
</li>
5151
<li>
52-
{% trans %}score.popContent.cpWeight{%endtrans %} :
53-
{{ projectAnalyzer.getScoreWeightParam('cpWeight')}}
52+
{% trans %}score.popContent.cpWeight{% endtrans %} :
53+
{{ projectAnalyzer.getScoreWeightParam('cpWeight') }}
5454
</li>
5555
<li>
56-
{% trans %}score.popContent.scWeight{%endtrans %} :
57-
{{ projectAnalyzer.getScoreWeightParam('scWeight')}}
56+
{% trans %}score.popContent.scWeight{% endtrans %} :
57+
{{ projectAnalyzer.getScoreWeightParam('scWeight') }}
5858
</li>
5959
<li>
60-
{% trans %}score.popContent.testWeight{%endtrans %} :
61-
{{ projectAnalyzer.getScoreWeightParam('testWeight')}}
60+
{% trans %}score.popContent.testWeight{% endtrans %} :
61+
{{ projectAnalyzer.getScoreWeightParam('testWeight') }}
6262
</li>
6363
<li>
64-
{% trans %}score.popContent.sizeWeight{%endtrans %} :
64+
{% trans %}score.popContent.sizeWeight{% endtrans %} :
6565
{{ projectAnalyzer.getScoreWeightParam('locWeight') }}
6666
</li>
6767
<li>
68-
{% trans %}score.popContent.scale{%endtrans %} :
68+
{% trans %}score.popContent.scale{% endtrans %} :
6969
{{ projectAnalyzer.getParam('score', 'projectSize') }}
7070
</li>
7171
</ul>
7272
">
73-
</td>
74-
</tr>
73+
</td>
74+
</tr>
7575
{% endif %}
76+
77+
<tr>
78+
<td>Symfony</td>
79+
<td>{{ projectAnalyzer.analyze.symfonyVersion }}</td>
80+
</tr>
7681
</table>
7782
</div>
7883
</div>

0 commit comments

Comments
 (0)