1 | <?php |
||
19 | class Editor |
||
20 | { |
||
21 | |||
22 | /** |
||
23 | * Hook class instance |
||
24 | * @var \gplcart\core\Hook $hook |
||
25 | */ |
||
26 | protected $hook; |
||
27 | |||
28 | /** |
||
29 | * Module class instance |
||
30 | * @var \gplcart\core\Module $module |
||
31 | */ |
||
32 | protected $module; |
||
33 | |||
34 | /** |
||
35 | * @param Hook $hook |
||
36 | * @param Module $module |
||
37 | */ |
||
38 | public function __construct(Hook $hook, Module $module) |
||
43 | |||
44 | /** |
||
45 | * Returns an array of editable files |
||
46 | * @param array $module |
||
47 | * @return array |
||
48 | */ |
||
49 | public function getList(array $module) |
||
62 | |||
63 | /** |
||
64 | * Returns an array of folder names to scan |
||
65 | * @return array |
||
66 | */ |
||
67 | protected function getScanFolders() |
||
71 | |||
72 | /** |
||
73 | * Saves an edited file |
||
74 | * @param array $data |
||
75 | * @return boolean |
||
76 | */ |
||
77 | public function save($data) |
||
94 | |||
95 | /** |
||
96 | * Backup a module |
||
97 | * @param array $data |
||
98 | * @return bool |
||
99 | */ |
||
100 | protected function backup(array $data) |
||
120 | |||
121 | /** |
||
122 | * Writes a content to a file |
||
123 | * @param string $content |
||
124 | * @param string $file |
||
125 | * @return boolean |
||
126 | */ |
||
127 | protected function write($content, $file) |
||
135 | |||
136 | /** |
||
137 | * Tries to validate syntax of a PHP file |
||
138 | * @param string $file |
||
139 | * @return mixed |
||
140 | */ |
||
141 | public function validatePhpFile($file) |
||
153 | |||
154 | /** |
||
155 | * Whether it's possible to validate a PHP code |
||
156 | * @return bool |
||
157 | */ |
||
158 | public function canValidatePhpCode() |
||
162 | |||
163 | /** |
||
164 | * Tries to validate a PHP code |
||
165 | * @param string $code |
||
166 | * @return mixed |
||
167 | */ |
||
168 | public function validatePhpCode($code) |
||
178 | |||
179 | } |
||
180 |