1 | <?php |
||
20 | class Config |
||
21 | { |
||
22 | /** |
||
23 | * Path to the config file |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | private $path; |
||
28 | |||
29 | /** |
||
30 | * Does the config file exist |
||
31 | * |
||
32 | * @var bool |
||
33 | */ |
||
34 | private $fileExists; |
||
35 | |||
36 | /** |
||
37 | * List of hook configs |
||
38 | * |
||
39 | * @var \SebastianFeldmann\CaptainHook\Config\Hook[] |
||
40 | */ |
||
41 | private $hooks = []; |
||
42 | |||
43 | /** |
||
44 | * Config constructor. |
||
45 | * |
||
46 | * @param string $path |
||
47 | * @param bool $fileExists |
||
48 | */ |
||
49 | 35 | public function __construct(string $path, bool $fileExists = false) |
|
57 | |||
58 | /** |
||
59 | * Is configuration loaded from file. |
||
60 | * |
||
61 | * @return bool |
||
62 | */ |
||
63 | 13 | public function isLoadedFromFile() : bool |
|
67 | |||
68 | /** |
||
69 | * Path getter. |
||
70 | * |
||
71 | * @return string |
||
72 | */ |
||
73 | 6 | public function getPath() : string |
|
77 | |||
78 | /** |
||
79 | * Return config for given hook. |
||
80 | * |
||
81 | * @param string $hook |
||
82 | * @return \SebastianFeldmann\CaptainHook\Config\Hook |
||
83 | * @throws \InvalidArgumentException |
||
84 | */ |
||
85 | 13 | public function getHookConfig(string $hook) : Config\Hook |
|
92 | |||
93 | /** |
||
94 | * Return config array to write to disc. |
||
95 | * |
||
96 | * @return array |
||
97 | */ |
||
98 | 3 | public function getJsonData() : array |
|
106 | } |
||
107 |