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

ArrayUtility   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 1
dl 0
loc 15
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
     * @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