1 | <?php |
||
15 | class Read extends Command |
||
16 | { |
||
17 | |||
18 | /** |
||
19 | * Whether the command is allowed for the file |
||
20 | * @param \SplFileInfo $file |
||
21 | * @return bool |
||
22 | */ |
||
23 | public function allowed($file) |
||
27 | |||
28 | /** |
||
29 | * Returns an array of data used to display the command |
||
30 | * @param \SplFileInfo $file |
||
31 | * @param \gplcart\core\Controller $controller |
||
32 | * @return array |
||
33 | */ |
||
34 | public function view($file, $controller) |
||
40 | |||
41 | /** |
||
42 | * Returns an array if reader methods and their supported file extensions |
||
43 | * @return array |
||
44 | */ |
||
45 | protected function getMethods() |
||
52 | |||
53 | /** |
||
54 | * Calls a method to read a file using its extension |
||
55 | * @param \SplFileInfo $file |
||
56 | * @param \gplcart\core\Controller $controller |
||
57 | * @return string |
||
58 | */ |
||
59 | protected function callReadMethod($file, $controller) |
||
75 | |||
76 | /** |
||
77 | * Returns rendered image content |
||
78 | * @param \SplFileInfo $file |
||
79 | * @param \gplcart\core\Controller $controller |
||
80 | * @return string |
||
81 | */ |
||
82 | protected function viewImage($file, $controller) |
||
94 | |||
95 | /** |
||
96 | * Returns rendered text content |
||
97 | * @param \SplFileInfo $file |
||
98 | * @param \gplcart\core\Controller $controller |
||
99 | * @return string |
||
100 | */ |
||
101 | protected function viewText($file, $controller) |
||
110 | |||
111 | /** |
||
112 | * Returns rendered file info content |
||
113 | * @param \SplFileInfo $file |
||
114 | * @param \gplcart\core\Controller $controller |
||
115 | * @return string |
||
116 | */ |
||
117 | protected function viewInfo($file, $controller) |
||
127 | |||
128 | } |
||
129 |