ResultsTypes::get()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 5
rs 10
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