Code Duplication    Length = 21-21 lines in 2 locations

src/Phossa2/Shared/Reader/IniReader.php 1 location

@@ 27-47 (lines=21) @@
24
 * @version 2.0.1
25
 * @since   2.0.1 added
26
 */
27
class IniReader extends ReaderAbstract
28
{
29
    /**
30
     * {@inheritDoc}
31
     */
32
    public static function readFile(/*# string */ $path)
33
    {
34
        // check first
35
        static::checkPath($path);
36
37
        // load ini file
38
        $data = @parse_ini_file($path, true);
39
40
        if (false === $data) {
41
            $error = error_get_last();
42
            throw new RuntimeException($error['message']);
43
        }
44
45
        return $data;
46
    }
47
}
48

src/Phossa2/Shared/Reader/SerializedReader.php 1 location

@@ 27-47 (lines=21) @@
24
 * @version 2.0.1
25
 * @since   2.0.1 added
26
 */
27
class SerializedReader extends ReaderAbstract
28
{
29
    /**
30
     * {@inheritDoc}
31
     */
32
    public static function readFile(/*# string */ $path)
33
    {
34
        // check first
35
        static::checkPath($path);
36
37
        // read
38
        $data = @unserialize(file_get_contents($path));
39
40
        if (false === $data) {
41
            $error = error_get_last();
42
            throw new RuntimeException($error['message']);
43
        }
44
45
        return $data;
46
    }
47
}
48