ResultsTypes::getTypes()   A
last analyzed

Complexity

Conditions 4
Paths 2

Size

Total Lines 16
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 10
nc 2
nop 0
dl 0
loc 16
rs 9.9332
c 0
b 0
f 0
1
<?php
2
3
namespace rOpenDev\Google;
4
5
class ResultsTypes
6
{
7
    protected $types;
8
9
    public static function get()
10
    {
11
        $current = new self();
12
13
        return $current->getTypes();
14
    }
15
16
    public function getTypes()
17
    {
18
        if (null === $this->types) {
19
            $file = __DIR__.'/ResultTypes.csv';
20
            $content = file_get_contents($file);
21
            $rows = explode(\chr(10), $content);
22
            array_shift($rows);
23
            foreach ($rows as $row) {
24
                $row = explode(',', $row);
25
                if (isset($row[1])) {
26
                    $this->types[strtolower($row[0])] = $row[1];
27
                }
28
            }
29
        }
30
31
        return $this->types;
32
    }
33
}
34