Conditions | 5 |
Paths | 5 |
Total Lines | 31 |
Code Lines | 17 |
Lines | 3 |
Ratio | 9.68 % |
Tests | 19 |
CRAP Score | 5 |
Changes | 5 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
43 | 8 | public function getData() |
|
44 | { |
||
45 | 8 | $collectors = []; |
|
46 | |||
47 | 8 | $dataCollectors = $this->profiler->getCollectors(); |
|
48 | 8 | $dataCollectors = call_user_func_array('array_merge', $dataCollectors); |
|
49 | 8 | foreach ($dataCollectors as $collector) { |
|
50 | 8 | if ($collector instanceof RenderableInterface) { |
|
51 | 8 | $renderer = $collector->getRenderer(); |
|
52 | |||
53 | 8 | if (!$renderer instanceof PageInterface) { |
|
54 | 8 | continue; |
|
55 | } |
||
56 | |||
57 | $data = [ |
||
58 | 'value' => null |
||
59 | 6 | ]; |
|
60 | 6 | View Code Duplication | if (array_key_exists($collector->getPath(), $this->profile)) { |
|
|||
61 | 2 | $data['value'] = $this->profile[$collector->getPath()]; |
|
62 | 2 | } |
|
63 | |||
64 | 6 | $collectors[$collector->getName()] = $renderer->setData($data); |
|
65 | 6 | } |
|
66 | 8 | } |
|
67 | |||
68 | return [ |
||
69 | 8 | 'collectors' => $collectors, |
|
70 | // build the bar |
||
71 | 8 | 'bar' => (new Bar($this->profile, $this->profiler)) |
|
72 | 8 | ]; |
|
73 | } |
||
74 | |||
91 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.