Completed
Push — dev ( d0b24b...3e90e1 )
by Gaige
04:11
created

ManifestReader::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
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
     * @var
23
     */
24
    private $mixManifest;
25
26
    /**
27
     * ManifestReader constructor.
28
     */
29
    public function __construct()
30
    {
31
        $this->mixManifest = public_path('mix-manifest.json');
32
    }
33
34
    /**
35
     * @return array
36
     * @throws Exception
37
     */
38
    public function getMixManifest(): array
39
    {
40
        if (File::exists($this->mixManifest)) {
41
            return json_decode(file_get_contents($this->mixManifest), true);
42
        } else {
43
            throw new Exception('Incorrect file path or file does not exist for mix-manfest.json');
44
        }
45
    }
46
47
}
48