|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* (c) Jean-François Lépine <https://twitter.com/Halleck45> |
|
5
|
|
|
* |
|
6
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
7
|
|
|
* file that was distributed with this source code. |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
namespace Hal\Application\Command\Job; |
|
11
|
|
|
use Hal\Application\Formater\Chart; |
|
12
|
|
|
use Hal\Application\Formater\Details; |
|
13
|
|
|
use Hal\Application\Formater\Summary; |
|
14
|
|
|
use Hal\Application\Formater\Violations; |
|
15
|
|
|
use Hal\Application\Score\Scoring; |
|
16
|
|
|
use Hal\Component\Aggregator\DirectoryAggregatorFlat; |
|
17
|
|
|
use Hal\Component\Bounds\BoundsInterface; |
|
18
|
|
|
use Hal\Component\Config\ConfigurationInterface; |
|
19
|
|
|
use Hal\Component\File\Finder; |
|
20
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
21
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Queue factory |
|
25
|
|
|
* |
|
26
|
|
|
* @author Jean-François Lépine <https://twitter.com/Halleck45> |
|
27
|
|
|
*/ |
|
28
|
|
|
class QueueFactory |
|
29
|
|
|
{ |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @var ConfigurationInterface |
|
33
|
|
|
*/ |
|
34
|
|
|
private $config; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @var OutputInterface |
|
38
|
|
|
*/ |
|
39
|
|
|
private $output; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @var InputInterface |
|
43
|
|
|
*/ |
|
44
|
|
|
private $input; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* Constructor |
|
48
|
|
|
* |
|
49
|
|
|
* @param InputInterface $input |
|
50
|
|
|
* @param OutputInterface $output |
|
51
|
|
|
* @param ConfigurationInterface $config |
|
52
|
|
|
*/ |
|
53
|
|
|
public function __construct(InputInterface $input, OutputInterface $output, ConfigurationInterface $config) |
|
54
|
|
|
{ |
|
55
|
|
|
$this->config = $config; |
|
56
|
|
|
$this->input = $input; |
|
57
|
|
|
$this->output = $output; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* Factory queue |
|
62
|
|
|
* |
|
63
|
|
|
* @param Finder $finder |
|
64
|
|
|
* @param BoundsInterface $bounds |
|
65
|
|
|
* @return Queue |
|
66
|
|
|
*/ |
|
67
|
|
|
public function factory(Finder $finder, BoundsInterface $bounds) { |
|
68
|
|
|
$rules = $this->config->getRuleSet(); |
|
69
|
|
|
$validator = new \Hal\Application\Rule\Validator($rules); |
|
70
|
|
|
|
|
71
|
|
|
// jobs queue planning |
|
72
|
|
|
$queue = new Queue; |
|
73
|
|
|
$queue |
|
74
|
|
|
->push(new DoAnalyze($this->output, $finder, $this->config->getPath()->getBasePath(), !$this->input->getOption('without-oop'), $this->config->getIgnoreErrors())) |
|
75
|
|
|
->push(new SearchBounds($this->output, $bounds)) |
|
76
|
|
|
->push(new DoAggregatedAnalyze($this->output, new DirectoryAggregatorFlat($this->input->getOption('level')))) |
|
77
|
|
|
->push(new CalculateScore(new Scoring($bounds))) |
|
78
|
|
|
->push(new ReportRenderer(true, $this->output, new Summary\Cli($validator, $bounds, $this->output))) |
|
79
|
|
|
->push(new ReportRenderer($this->config->getLogging()->getReport('cli'), $this->output, new Details\Cli($validator, $bounds))) |
|
80
|
|
|
->push(new ReportWriter($this->config->getLogging()->getReport('html'), $this->output, new Summary\Html($validator, $bounds, $this->config->getTemplate()))) |
|
81
|
|
|
->push(new ReportWriter($this->config->getLogging()->getReport('json'), $this->output, new Details\Json($validator, $bounds))) |
|
|
|
|
|
|
82
|
|
|
->push(new ReportWriter($this->config->getLogging()->getReport('xml'), $this->output, new Summary\Xml($validator, $bounds))) |
|
83
|
|
|
->push(new ReportWriter($this->config->getLogging()->getReport('csv'), $this->output, new Details\Csv())) |
|
84
|
|
|
->push(new ReportWriter($this->config->getLogging()->getViolation('xml'), $this->output, new Violations\Xml($validator, $bounds))) |
|
85
|
|
|
->push(new ReportWriter($this->config->getLogging()->getChart('bubbles'), $this->output, new Chart\Bubbles($validator, $bounds))); |
|
86
|
|
|
|
|
87
|
|
|
return $queue; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
} |
|
91
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: