File::get()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
ccs 3
cts 3
cp 1
crap 1
1
<?php
2
namespace agoalofalife\bpm\SourcesConfigurations;
3
4
5
use agoalofalife\bpm\Contracts\SourceConfiguration;
6
use Assert\Assertion;
7
8
class File implements SourceConfiguration
9
{
10
11
    protected $pathToFile;
12
    protected $name = 'apiBpm';
13
14
    /**
15
     * get array with configuration
16
     * @return array
17
     */
18 1
    public function get()
19
    {
20 1
        $configuration =  require $this->pathToFile;
21 1
        return $configuration;
22
    }
23
24
    /**
25
     * @param $path string  path to file
26
     * @return bool
27
     */
28 3
    public function setSource($path)
29
    {
30 3
        if (file_exists($path))
31 3
        {
32 2
            $this->pathToFile = $path;
33 2
        } else{
34 1
            Assertion::file($path, 'Local file name is not exist.');
35
        }
36 2
        return true;
37
    }
38
39
    /**
40
     * @return string
41
     */
42 1
    public function getName()
43
    {
44 1
        return $this->name;
45
    }
46
}