Completed
Push — master ( 11f33f...14005b )
by Tim
10:31 queued 07:40
created

ArrayUtility   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 2
c 2
b 0
f 1
lcom 0
cbo 1
dl 0
loc 18
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A buildIndexActionArray() 0 7 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
     * Append the errors of an api call to
17
     * metaDataArray
18
     *
19
     * @param $metaDataArray
20
     * @param $section
21
     */
22
    public static function buildIndexActionArray(&$metaDataArray, $section)
23
    {
24
        $loader = GeneralUtility::makeInstance(\HDNET\OnpageIntegration\Loader\ApiResultLoader::class);
25
        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...
26
            $metaDataArray[0][$i]['errors'] = $loader->load('zoom_' . $section . '_' . $i . '_graph');
27
        }
28
    }
29
}
30