Completed
Push — develop ( 840c69...29c45a )
by René
03:26
created

ArrayUtility::buildIndexActionArray()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 7
rs 9.4285
cc 2
eloc 4
nc 2
nop 2
1
<?php
2
/**
3
 * Class ArrayUtility
4
 */
5
namespace HDNET\OnpageIntegration\Utility;
6
7
use TYPO3\CMS\Core\Utility\GeneralUtility;
8
9
/**
10
 * Class ArrayUtility
11
 */
12
class ArrayUtility
13
{
14
15
    /**
16
     * @param $metaDataArray
17
     * @param $section
18
     */
19
    static public function buildIndexActionArray(&$metaDataArray, $section)
0 ignored issues
show
Coding Style introduced by
As per PSR2, the static declaration should come after the visibility declaration.
Loading history...
20
    {
21
        $loader = GeneralUtility::makeInstance(\HDNET\OnpageIntegration\Loader\ApiResultLoader::class);
22
        for ($i = 0; $i < count($metaDataArray[0]); $i++) {
0 ignored issues
show
Performance Best Practice introduced by
It seems like you are calling the size function count() as part of the test condition. You might want to compute the size beforehand, and not on each iteration.

If the size of the collection does not change during the iteration, it is generally a good practice to compute it beforehand, and not on each iteration:

for ($i=0; $i<count($array); $i++) { // calls count() on each iteration
}

// Better
for ($i=0, $c=count($array); $i<$c; $i++) { // calls count() just once
}
Loading history...
23
            $metaDataArray[0][$i]['errors'] = $loader->load('zoom_' . $section . '_' . $i . '_graph');
24
        }
25
    }
26
}
27