1 | <?php |
||
26 | trait FileTrait |
||
27 | { |
||
28 | /** |
||
29 | * The file used in the trait |
||
30 | * |
||
31 | * @var string |
||
32 | */ |
||
33 | private $file; |
||
34 | |||
35 | /** |
||
36 | * The parent Vars instance |
||
37 | * |
||
38 | * @var \M1\Vars\Vars |
||
39 | */ |
||
40 | private $vars; |
||
41 | |||
42 | /** |
||
43 | * Validates the file passed to see if it is a file and is readable |
||
44 | * |
||
45 | * @throws \RuntimeException If the file passed is not a file |
||
46 | * @throws \RuntimeException If the file passed is not readable |
||
47 | */ |
||
48 | 61 | private function validate() |
|
62 | |||
63 | /** |
||
64 | * Gets the supported loader for the passed file |
||
65 | * |
||
66 | * @see \M1\Vars\Vars::getLoaders() \M1\Vars\Vars::getLoaders() |
||
67 | * |
||
68 | * @param string $data The passed file |
||
69 | * |
||
70 | * @return mixed Returns the loader class or false if no loader calls was found |
||
71 | */ |
||
72 | 60 | private function getSupportedLoader($data) |
|
86 | |||
87 | /** |
||
88 | * Loads raw content from the file |
||
89 | * |
||
90 | * @param string $data The passed file |
||
91 | * |
||
92 | * @throws \InvalidArugmentException If the file passed is not supported by the current loaders |
||
93 | * |
||
94 | * @return mixed The content from the file via the loader |
||
95 | */ |
||
96 | 60 | private function loadContent($data) |
|
107 | |||
108 | /** |
||
109 | * Returns the passed file |
||
110 | * |
||
111 | * @return string The passed file |
||
112 | */ |
||
113 | 10 | public function getFile() |
|
117 | } |
||
118 |