Completed
Push — master ( 0c83ff...fee93b )
by Xeriab
04:37
created

Ini::group()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
/**
3
 * Konfig
4
 *
5
 * Yet another simple configuration file loader library.
6
 *
7
 * @author  Xeriab Nabil (aka KodeBurner) <[email protected]>
8
 * @license https://raw.github.com/xeriab/konfig/master/LICENSE MIT
9
 * @link    https://xeriab.github.io/projects/konfig
10
 */
11
namespace Exen\Konfig\FileParser;
12
13
use Exen\Konfig\Exception\ParseException;
14
use Piwik\Ini\INIReader as IniReader;
15
16
class Ini extends AbstractFileParser
17
{
18
    /**
19
     * {@inheritDoc}
20
     * Parses an INI file as an array
21
     *
22
     * @throws ParseException If there is an error parsing INI file
23
     * @since 0.1
24
     */
25
    public function parse($path)
26
    {
27
        $iniReader = new IniReader();
28
        $data      = $iniReader->readFile($path);
29
30
        if (empty($data)) {
31
            $error = error_get_last();
32
            throw new ParseException($error);
33
        }
34
35
        return $data;
36
    }
37
38
    /**
39
     * {@inheritDoc}
40
     * @since 0.1
41
     */
42
    public function load($overwrite = false, $cache = true)
0 ignored issues
show
Unused Code introduced by
The parameter $overwrite is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $cache is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
43
    {
44
        // Nothing to put here
45
    }
46
47
    /**
48
     * {@inheritDoc}
49
     * @since 0.1
50
     */
51
    public function group()
52
    {
53
        // Nothing to put here
54
    }
55
56
    /**
57
     * {@inheritDoc}
58
     * @since 0.1
59
     */
60
    public function getSupportedFileExtensions()
61
    {
62
        return ['ini', 'cfg', 'conf'];
63
    }
64
}
65
66
#: END OF ./src/FileParser/Ini.php FILE
67