Completed
Push — master ( 0813f7...c7b80b )
by Hong
01:46
created

PhpReader::readFromFile()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
/**
4
 * Phoole (PHP7.2+)
5
 *
6
 * @category  Library
7
 * @package   Phoole\Base
8
 * @copyright Copyright (c) 2019 Hong Zhang
9
 */
10
declare(strict_types=1);
11
12
namespace Phoole\Base\Reader;
13
14
/**
15
 * PhpReader
16
 *
17
 * @package Phoole\Base
18
 */
19
class PhpReader extends AbstractReader
20
{
21
    /**
22
     * {@inheritDoc}
23
     */
24
    protected function readFromFile($path)
25
    {
26
        try {
27
            return include $path;
28
        } catch (\Exception $e) {
29
            throw new \RuntimeException($e->getMessage());
30
        }
31
    }
32
}
33