Completed
Pull Request — develop (#127)
by
unknown
17:47 queued 02:46
created

Serialize   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 28
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A parseFile() 0 5 1
A parseString() 0 4 1
A getSupportedExtensions() 0 4 1
1
<?php
2
3
namespace Noodlehaus\Parser;
4
5
/**
6
 * Class Serialize
7
 *
8
 * @package Config
9
 */
10
class Serialize implements ParserInterface
11
{
12
13
    /**
14
     * {@inheritdoc}
15
     */
16
    public function parseFile($filename)
17
    {
18
        $data = file_get_contents($filename);
19
        return $this->parseString($data);
20
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function parseString($config)
26
    {
27
        return (array) unserialize($config);
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public static function getSupportedExtensions()
34
    {
35
        return ['txt'];
36
    }
37
}
38