ApiDataProcessing   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 29
ccs 18
cts 18
cp 1
rs 10
wmc 6

3 Methods

Rating   Name   Duplication   Size   Complexity  
A loopThroughDesc() 0 8 2
A loopThroughTemp() 0 8 2
A loopThroughDate() 0 8 2
1
<?php
2
3
namespace Asti\Weather;
4
5
6
/**
7
 * A sample controller to show how a controller class can be implemented.
8
 * The controller will be injected with $di if implementing the interface
9
 * ContainerInjectableInterface, like this sample class does.
10
 * The controller is mounted on a particular route and can then handle all
11
 * requests for that mount point.
12
 *
13
 * @SuppressWarnings(PHPMD.TooManyPublicMethods)
14
 */
15
class ApiDataProcessing
16
{
17
18 3
    public function loopThroughDate($dateArray): array
19
    {
20 3
        $newDateArray = [];
21 3
        forEach ($dateArray as $date) {
22 3
            $modifiedDate = date("Y-m-d", array_shift($date));
23 3
            array_push($newDateArray, $modifiedDate);
24
        }
25 3
        return $newDateArray;
26
    }
27 3
    public function loopThroughTemp($dateArray, $el1, $el2): array
28
    {
29 3
        $newTempArray = [];
30 3
        forEach ($dateArray as $temp) {
31 3
            $modTemp = $temp[$el1][$el2];
32 3
            array_push($newTempArray, substr($modTemp,0 ,5));
33
        }
34 3
        return $newTempArray;
35
    }
36 3
    public function loopThroughDesc($dateArray, $el1, $el2): array
37
    {
38 3
        $newDescArray = [];
39 3
        forEach ($dateArray as $desc) {
40 3
            $modDesc = $desc[$el1][0][$el2];
41 3
            array_push($newDescArray, $modDesc);
42
        }
43 3
        return $newDescArray;
44
    }
45
}
46