GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#4)
by Flemming
02:51
created

Factory   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 85.71%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 3
dl 0
loc 47
c 0
b 0
f 0
ccs 12
cts 14
cp 0.8571
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A fromArray() 0 6 1
A fromIniSections() 0 14 3
A fromFile() 0 4 1
1
<?php
2
3
namespace FlmBus\Ini\IniFile;
4
5
use FlmBus\Ini\Exceptions\InvalidDataException;
6
use FlmBus\Ini\IniFile;
7
use FlmBus\Ini\IniParser;
8
use FlmBus\Ini\IniSection;
9
10
class Factory
11
{
12
    /**
13
     * @param array $data
14
     *
15
     * @return IniFile
16
     * @throws \FlmBus\Ini\Exceptions\InvalidDataException
17
     */
18 2
    public static function fromArray(array $data)
19
    {
20 2
        $iniSections = IniParser::i()->parseArray($data);
21
22 1
        return self::fromIniSections($iniSections);
23
    }
24
25
    /**
26
     * @param IniSection[] $iniSections
27
     *
28
     * @return IniFile
29
     * @throws InvalidDataException
30
     */
31 4
    public static function fromIniSections(array $iniSections)
32
    {
33 4
        $iniFile = new IniFile();
34 4
        foreach ($iniSections as $iniSection)
35
        {
36 2
            if (false === $iniSection instanceof IniSection)
37 2
            {
38 1
                throw new InvalidDataException('Invalid data! ');
39
            }
40 1
            $iniFile->addSection($iniSection);
41 3
        }
42
43 3
        return $iniFile;
44
    }
45
46
    /**
47
     * @param string $file File path
48
     *
49
     * @return IniFile
50
     */
51
    public static function fromFile($file)
52
    {
53
        return new IniFile($file);
54
    }
55
56
}