1 | <?php |
||
30 | trait LoadEnvTrait |
||
31 | { |
||
32 | /** |
||
33 | * marker for sourcing another env file |
||
34 | * |
||
35 | * @var string |
||
36 | * @access private |
||
37 | */ |
||
38 | private $source_marker = '__SOURCING_FILE__'; |
||
39 | |||
40 | /** |
||
41 | * Load & parse, return the key/value pairs |
||
42 | * |
||
43 | * @param string $path |
||
44 | * @return array |
||
45 | * @throws LogicException if $path not readable or failure |
||
46 | * @access protected |
||
47 | */ |
||
48 | protected function loadEnv(/*# string */ $path)/*# : array */ |
||
65 | |||
66 | /** |
||
67 | * Read from a file, returns the content string |
||
68 | * |
||
69 | * @param string $path |
||
70 | * @throws LogicException if $path not readable or failure |
||
71 | * @return string |
||
72 | * @access protected |
||
73 | */ |
||
74 | protected function readContent(/*# string */ $path)/*# : string */ |
||
87 | |||
88 | /** |
||
89 | * Parse whole string into key/value pairs |
||
90 | * |
||
91 | * @param string $string |
||
92 | * @return array |
||
93 | * @access protected |
||
94 | */ |
||
95 | protected function parseString(/*# string */ $string)/*# : array */ |
||
116 | |||
117 | /** |
||
118 | * Clean up, return key/value pairs |
||
119 | * |
||
120 | * @param array $matched |
||
121 | * @return array |
||
122 | * @access protected |
||
123 | */ |
||
124 | protected function clearPairs(/*# array */ $matched)/*# : array */ |
||
144 | |||
145 | /** |
||
146 | * Expand PATH/DIR/FILENAME in key & value |
||
147 | * |
||
148 | * @param array &$data |
||
149 | * @param string $path |
||
150 | * @access protected |
||
151 | * @since 2.0.2 added support for ${0} etc. |
||
152 | * @since 2.0.3 changed to ${BASH_SOURCE} |
||
153 | */ |
||
154 | protected function expandMagic(array &$data, $path) |
||
176 | } |
||
177 |