1 | <?php |
||||
2 | |||||
3 | namespace Drupal\qa\Workflows; |
||||
4 | |||||
5 | use Drupal\Core\DependencyInjection\ContainerInjectionInterface; |
||||
6 | use Drupal\Core\Entity\EntityStorageInterface; |
||||
7 | use Drupal\Core\Entity\EntityTypeManagerInterface; |
||||
8 | use Drupal\Core\StringTranslation\StringTranslationTrait; |
||||
9 | use Grafizzi\Graph\Attribute; |
||||
0 ignored issues
–
show
|
|||||
10 | use Grafizzi\Graph\Edge; |
||||
0 ignored issues
–
show
The type
Grafizzi\Graph\Edge was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
11 | use Grafizzi\Graph\Graph; |
||||
0 ignored issues
–
show
The type
Grafizzi\Graph\Graph was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
12 | use Grafizzi\Graph\Node; |
||||
0 ignored issues
–
show
The type
Grafizzi\Graph\Node was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
13 | use Monolog\Handler\StreamHandler; |
||||
0 ignored issues
–
show
The type
Monolog\Handler\StreamHandler was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
14 | use Monolog\Logger; |
||||
0 ignored issues
–
show
The type
Monolog\Logger was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
15 | use Pimple\Container; |
||||
0 ignored issues
–
show
The type
Pimple\Container was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
16 | use Symfony\Component\DependencyInjection\ContainerInterface; |
||||
17 | |||||
18 | class ContentModerationGraph extends ContentModerationReportBase implements ContainerInjectionInterface { |
||||
0 ignored issues
–
show
The type
Drupal\qa\Workflows\ContentModerationReportBase was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
19 | |||||
20 | use StringTranslationTrait; |
||||
21 | |||||
22 | /** |
||||
23 | * The Pimple instance used by Grafizzi. |
||||
24 | * |
||||
25 | * @var \Pimple\Container |
||||
26 | */ |
||||
27 | protected $pimple; |
||||
28 | |||||
29 | public function __construct(EntityStorageInterface $stateStorage, EntityStorageInterface $transStorage, Container $pimple) { |
||||
30 | $this->pimple = $pimple; |
||||
31 | $this->stateStorage = $stateStorage; |
||||
0 ignored issues
–
show
|
|||||
32 | $this->transStorage = $transStorage; |
||||
0 ignored issues
–
show
|
|||||
33 | } |
||||
34 | |||||
35 | /** |
||||
36 | * @return \Grafizzi\Graph\Graph |
||||
37 | */ |
||||
38 | protected function buildGraph() { |
||||
39 | $dic = $this->pimple; |
||||
40 | $g = new Graph($dic); |
||||
41 | $states = $this->getStates(); |
||||
42 | $transList = $this->getTrans(); |
||||
43 | |||||
44 | $nodes = []; |
||||
45 | foreach ($states as $name => $label) { |
||||
46 | $nodes[$name] = new Node($dic, $name, [ |
||||
47 | new Attribute($dic, 'label', "${label}\n${name}"), |
||||
48 | ]); |
||||
49 | $g->addChild($nodes[$name]); |
||||
50 | } |
||||
51 | |||||
52 | foreach ($transList as $name => $trans) { |
||||
53 | $g->addChild(new Edge($dic, |
||||
54 | $nodes[$trans['from']], |
||||
55 | $nodes[$trans['to']], |
||||
56 | [new Attribute($dic, 'label', "${trans['label']}\n$name")] |
||||
57 | )); |
||||
58 | } |
||||
59 | |||||
60 | return $g; |
||||
61 | } |
||||
62 | |||||
63 | protected function buildRow(string $stateId, array $transList) { |
||||
64 | $states = $this->getStates(); |
||||
65 | $trans = $this->getTrans(); |
||||
66 | $row = ["${states[$stateId]}\n${stateId}"]; |
||||
67 | foreach ($transList as $from => $transIds) { |
||||
68 | $cellArray = []; |
||||
69 | foreach ($transIds as $transId) { |
||||
70 | assert($trans[$transId]['from'] = $stateId); |
||||
71 | $transLabel = $trans[$transId]['label']; |
||||
72 | } |
||||
73 | $cellArray[] = $transLabel; |
||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||
74 | $cellArray[] = $transId; |
||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||
75 | $cellArray[] = ""; |
||||
76 | $cell = implode("\n", $cellArray); |
||||
77 | $row[$trans[$transId]['to']] = $cell; |
||||
78 | } |
||||
79 | |||||
80 | return $row; |
||||
81 | } |
||||
82 | |||||
83 | public static function create(ContainerInterface $container) { |
||||
84 | /** @var EntityTypeManagerInterface $etm */ |
||||
85 | $etm = $container->get('entity_type.manager'); |
||||
86 | |||||
87 | $stateStorage = $etm->getStorage('moderation_state'); |
||||
88 | $transStorage = $etm->getStorage('moderation_state_transition'); |
||||
89 | |||||
90 | $logger = new Logger(basename(__FILE__, '.php')); |
||||
91 | // Change the minimum logging level using the Logger:: constants. |
||||
92 | $logger->pushHandler(new StreamHandler('php://stderr', Logger::INFO)); |
||||
93 | |||||
94 | $pimple = new Container([ |
||||
95 | 'logger' => $logger, |
||||
96 | 'directed' => TRUE, |
||||
97 | ]); |
||||
98 | |||||
99 | return new static($stateStorage, $transStorage, $pimple); |
||||
100 | } |
||||
101 | |||||
102 | public function report() { |
||||
103 | $grid = $this->buildGrid(); |
||||
104 | return $this->buildGraph($grid) |
||||
0 ignored issues
–
show
The call to
Drupal\qa\Workflows\Cont...tionGraph::buildGraph() has too many arguments starting with $grid .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||
105 | ->build(); |
||||
106 | } |
||||
107 | |||||
108 | } |
||||
109 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths