PhpHandler   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 42
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A load() 0 10 2
A save() 0 6 1
A parseInline() 0 4 1
A dumpInline() 0 4 1
1
<?php
2
3
namespace Incenteev\ParameterHandler\FileHandler;
4
5
class PhpHandler
6
{
7
    /**
8
     * {@inheritdoc}
9
     */
10
    public function load($filePath)
11
    {
12
        $data = include $filePath;
13
14
        if (is_int($data)) {
15
            return [];
16
        }
17
18
        return $data;
19
    }
20
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function save($filePath, $data)
25
    {
26
        $contents = sprintf("<?php\n// This file is auto-generated during the composer install\nreturn %s;\n", var_export($data, true));
27
28
        return file_put_contents($filePath, $contents);
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function parseInline($value)
35
    {
36
        return $value;
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function dumpInline($value)
43
    {
44
        return $value;
45
    }
46
}
47