Completed
Push — master ( 61ee69...43d18c )
by Gaige
14s queued 11s
created

ManifestReader::getManifest()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
3
4
namespace ExoUNX\Vasri;
5
6
7
use Illuminate\Support\Facades\File;
8
use Exception;
9
10
/**
11
 * Class ManifestReader
12
 *
13
 * @package ExoUNX\Vasri
14
 * @author  Gaige Lama <[email protected]>
15
 * @license MIT License
16
 * @link    https://github.com/ExoUNX/Vasri
17
 */
18
class ManifestReader
19
{
20
21
    /**
22
     * @param  string  $file
23
     *
24
     * @return array
25
     * @throws Exception
26
     */
27
    public function getManifest(string $file): array
28
    {
29
        if (File::exists($file)) {
30
            return json_decode(file_get_contents($file), true);
31
        } else {
32
            throw new Exception('Incorrect file path or file does not exist for '.$file);
33
        }
34
    }
35
36
}
37