Completed
Push — master ( d621a8...b2ef5f )
by Hong
02:39
created

PhpReader::readFromFile()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 11
rs 9.4285
cc 2
eloc 7
nc 2
nop 1
1
<?php
2
/**
3
 * Phossa Project
4
 *
5
 * PHP version 5.4
6
 *
7
 * @category  Library
8
 * @package   Phossa2\Shared
9
 * @copyright Copyright (c) 2016 phossa.com
10
 * @license   http://mit-license.org/ MIT License
11
 * @link      http://www.phossa.com/
12
 */
13
/*# declare(strict_types=1); */
14
15
namespace Phossa2\Shared\Reader;
16
17
use Phossa2\Shared\Exception\RuntimeException;
18
19
/**
20
 * Read & parse php formatted file and return the result
21
 *
22
 * @package Phossa2\Shared
23
 * @author  Hong Zhang <[email protected]>
24
 * @version 2.0.1
25
 * @since   2.0.1 added
26
 */
27
class PhpReader extends ReaderAbstract
28
{
29
    /**
30
     * {@inheritDoc}
31
     */
32
    protected static function readFromFile($path)
33
    {
34
        try {
35
            return include $path;
36
        } catch (\Exception $exception) {
37
            throw new RuntimeException(
38
                $exception->getMessage(),
39
                $exception->getCode()
40
            );
41
        }
42
    }
43
}
44