ResultsTypes   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getTypes() 0 16 4
A get() 0 5 1
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