Completed
Pull Request — develop (#79)
by
unknown
44:24 queued 32:59
created

Ini   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 3
c 2
b 0
f 1
lcom 0
cbo 1
dl 0
loc 28
ccs 8
cts 8
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getSupportedExtensions() 0 4 1
A parse() 0 11 2
1
<?php
2
3
namespace Noodlehaus\FileParser;
4
5
use Noodlehaus\Exception\ParseException;
6
7
/**
8
 * INI file parser
9
 *
10
 * @package    Config
11
 * @author     Jesus A. Domingo <[email protected]>
12
 * @author     Hassan Khan <[email protected]>
13
 * @link       https://github.com/noodlehaus/config
14
 * @license    MIT
15
 */
16
class Ini implements FileParserInterface
17
{
18
    /**
19
     * {@inheritDoc}
20
     * Parses an INI file as an array
21
     *
22
     * @throws ParseException If there is an error parsing the INI file
23
     */
24 6
    public function parse($path)
25
    {
26 6
        $data = @parse_ini_file($path, true);
27
28 6
        if (!$data) {
29 3
            $error = error_get_last();
30 3
            throw new ParseException($error);
31
        }
32
33 3
        return $data;
34
    }
35
36
    /**
37
     * {@inheritDoc}
38
     */
39 3
    public function getSupportedExtensions()
40
    {
41 3
        return array('ini');
42
    }
43
}
44