File   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 39
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 5 1
A setSource() 0 10 2
A getName() 0 4 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
}