@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @return array |
35 | 35 | */ |
36 | - public function process($eventListeners, Event $event, $resultType = null, $limit = null){ |
|
36 | + public function process($eventListeners, Event $event, $resultType = null, $limit = null) { |
|
37 | 37 | $eventListeners = $this->orderByPriority($eventListeners); |
38 | 38 | |
39 | - $results = []; |
|
39 | + $results = [ ]; |
|
40 | 40 | |
41 | 41 | /* @var $eventListener EventListener */ |
42 | 42 | foreach ($eventListeners as $eventListener) { |
@@ -55,17 +55,17 @@ discard block |
||
55 | 55 | $handler, |
56 | 56 | $method, |
57 | 57 | |
58 | - ], [$event]); |
|
58 | + ], [ $event ]); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | if ($this->isNull($resultType) |
62 | 62 | || (!$this->isNull($resultType) |
63 | 63 | && $this->isInstanceOf($result, $resultType)) |
64 | - ){ |
|
65 | - $results[] = $result; |
|
64 | + ) { |
|
65 | + $results[ ] = $result; |
|
66 | 66 | |
67 | 67 | if ($limit === 1 && count($results) === 1) { |
68 | - return $results[0]; |
|
68 | + return $results[ 0 ]; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | if (count($results) === $limit) { |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @return int |
98 | 98 | */ |
99 | - $comparisonFunction = function ($a, $b) { |
|
99 | + $comparisonFunction = function($a, $b) { |
|
100 | 100 | if ($a->getPriority() == $b->getPriority()) { |
101 | 101 | // This will keep the order of same priority listeners in the order of subscribing |
102 | 102 | return 1; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | umask($umask); |
50 | 50 | |
51 | 51 | if (!$created) { |
52 | - handle(new StorageException(StorageException::DIRECTORY_COULD_NOT_BE_CREATED, [$directory])); |
|
52 | + handle(new StorageException(StorageException::DIRECTORY_COULD_NOT_BE_CREATED, [ $directory ])); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | { |
64 | 64 | if (!is_dir($directory)) { |
65 | 65 | if (!$create) { |
66 | - handle(new StorageException(StorageException::DIRECTORY_DOES_NOT_EXIST, [$directory])); |
|
66 | + handle(new StorageException(StorageException::DIRECTORY_DOES_NOT_EXIST, [ $directory ])); |
|
67 | 67 | } |
68 | 68 | $this->createDirectory($directory); |
69 | 69 | } |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | } |
117 | 117 | break; |
118 | 118 | default: |
119 | - $tokens[] = $part; |
|
119 | + $tokens[ ] = $part; |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
123 | - return $prefix . implode('/', $tokens); |
|
123 | + return $prefix.implode('/', $tokens); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -134,11 +134,11 @@ discard block |
||
134 | 134 | { |
135 | 135 | preg_match('|^(?P<prefix>([a-zA-Z]:)?/)|', $path, $matches); |
136 | 136 | |
137 | - if (empty($matches['prefix'])) { |
|
137 | + if (empty($matches[ 'prefix' ])) { |
|
138 | 138 | return ''; |
139 | 139 | } |
140 | 140 | |
141 | - return strtolower($matches['prefix']); |
|
141 | + return strtolower($matches[ 'prefix' ]); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -154,6 +154,6 @@ discard block |
||
154 | 154 | { |
155 | 155 | $this->ensureDirectoryExists($directory, $create); |
156 | 156 | |
157 | - return $this->normalizeDirectoryPath($directory . '/' . $key); |
|
157 | + return $this->normalizeDirectoryPath($directory.'/'.$key); |
|
158 | 158 | } |
159 | 159 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @package app\framework\Component\Storage\Driver\Local |
23 | 23 | */ |
24 | -class LocalStorageDriver implements SizeAwareInterface,DriverInterface,AbsolutePathInterface,TouchableInterface,DirectoryAwareInterface |
|
24 | +class LocalStorageDriver implements SizeAwareInterface, DriverInterface, AbsolutePathInterface, TouchableInterface, DirectoryAwareInterface |
|
25 | 25 | { |
26 | 26 | /** |
27 | 27 | * @var string |
@@ -56,11 +56,11 @@ discard block |
||
56 | 56 | */ |
57 | 57 | function __construct($config) |
58 | 58 | { |
59 | - if(is_array($config)){ |
|
59 | + if (is_array($config)) { |
|
60 | 60 | $config = new ArrayObject($config); |
61 | 61 | } |
62 | 62 | |
63 | - if(!$config instanceof ArrayObject){ |
|
63 | + if (!$config instanceof ArrayObject) { |
|
64 | 64 | handle(new StorageException('Storage driver config must be an array or ArrayObject!')); |
65 | 65 | } |
66 | 66 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | { |
113 | 113 | $this->recentKey = $key; |
114 | 114 | |
115 | - if($this->keyExists($key)){ |
|
115 | + if ($this->keyExists($key)) { |
|
116 | 116 | return filesize($this->buildPath($key)); |
117 | 117 | } |
118 | 118 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | { |
131 | 131 | $this->recentKey = $key; |
132 | 132 | |
133 | - if($this->keyExists($key)){ |
|
133 | + if ($this->keyExists($key)) { |
|
134 | 134 | return file_get_contents($this->buildPath($key)); |
135 | 135 | } |
136 | 136 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | { |
152 | 152 | $this->recentKey = $key; |
153 | 153 | |
154 | - if($this->keyExists($key)) { |
|
154 | + if ($this->keyExists($key)) { |
|
155 | 155 | return file_put_contents($this->buildPath($key), $contents); |
156 | 156 | } |
157 | 157 | |
@@ -174,13 +174,13 @@ discard block |
||
174 | 174 | if ($key != '') { |
175 | 175 | $key = ltrim($key, DS); |
176 | 176 | $key = rtrim($key, DS); |
177 | - $path = $this->directory . DS . $key; |
|
177 | + $path = $this->directory.DS.$key; |
|
178 | 178 | } else { |
179 | 179 | $path = $this->directory; |
180 | 180 | } |
181 | 181 | |
182 | 182 | if (!is_dir($path)) { |
183 | - return []; |
|
183 | + return [ ]; |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | if ($recursive) { |
@@ -196,22 +196,22 @@ discard block |
||
196 | 196 | } |
197 | 197 | $files = iterator_to_array($iterator); |
198 | 198 | } else { |
199 | - $files = []; |
|
199 | + $files = [ ]; |
|
200 | 200 | $iterator = new \DirectoryIterator($path); |
201 | 201 | foreach ($iterator as $fileinfo) { |
202 | 202 | $name = $fileinfo->getFilename(); |
203 | 203 | if ($name == '.' || $name == '..') { |
204 | 204 | continue; |
205 | 205 | } |
206 | - $files[] = $fileinfo->getPathname(); |
|
206 | + $files[ ] = $fileinfo->getPathname(); |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
210 | - $keys = []; |
|
210 | + $keys = [ ]; |
|
211 | 211 | |
212 | 212 | |
213 | 213 | foreach ($files as $file) { |
214 | - $keys[] = $this->helper->getKey($file, $this->directory); |
|
214 | + $keys[ ] = $this->helper->getKey($file, $this->directory); |
|
215 | 215 | } |
216 | 216 | sort($keys); |
217 | 217 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | { |
231 | 231 | $this->recentKey = $key; |
232 | 232 | |
233 | - if($this->keyExists($key)){ |
|
233 | + if ($this->keyExists($key)) { |
|
234 | 234 | return filectime($this->buildPath($key)); |
235 | 235 | } |
236 | 236 | |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | { |
269 | 269 | $this->recentKey = $sourceKey; |
270 | 270 | |
271 | - if($this->keyExists($sourceKey)){ |
|
271 | + if ($this->keyExists($sourceKey)) { |
|
272 | 272 | $targetPath = $this->buildPath($targetKey); |
273 | 273 | $this->helper->ensureDirectoryExists(dirname($targetPath), true); |
274 | 274 | |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | { |
299 | 299 | $key = str_replace('\\', '/', $key); |
300 | 300 | |
301 | - return $this->publicUrl . '/' . ltrim($key, "/"); |
|
301 | + return $this->publicUrl.'/'.ltrim($key, "/"); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | /** |
@@ -6,27 +6,27 @@ |
||
6 | 6 | * @Author Marco Bier <[email protected]> |
7 | 7 | */ |
8 | 8 | |
9 | - namespace app\framework\Component\Storage; |
|
9 | + namespace app\framework\Component\Storage; |
|
10 | 10 | |
11 | - /** |
|
12 | - * A library of Storage functions |
|
13 | - * |
|
14 | - * @package app\framework\Component\Storage |
|
15 | - */ |
|
16 | - trait StorageTrait |
|
17 | - { |
|
18 | - /** |
|
19 | - * Get storage |
|
20 | - * |
|
21 | - * @param $storageName |
|
22 | - * @return Storage |
|
23 | - */ |
|
24 | - protected static function storage($storageName) |
|
25 | - { |
|
26 | - try { |
|
27 | - return new Storage($storageName); |
|
28 | - } catch(StorageException $e) { |
|
29 | - handle($e); |
|
30 | - } |
|
31 | - } |
|
32 | - } |
|
11 | + /** |
|
12 | + * A library of Storage functions |
|
13 | + * |
|
14 | + * @package app\framework\Component\Storage |
|
15 | + */ |
|
16 | + trait StorageTrait |
|
17 | + { |
|
18 | + /** |
|
19 | + * Get storage |
|
20 | + * |
|
21 | + * @param $storageName |
|
22 | + * @return Storage |
|
23 | + */ |
|
24 | + protected static function storage($storageName) |
|
25 | + { |
|
26 | + try { |
|
27 | + return new Storage($storageName); |
|
28 | + } catch(StorageException $e) { |
|
29 | + handle($e); |
|
30 | + } |
|
31 | + } |
|
32 | + } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | { |
26 | 26 | try { |
27 | 27 | return new Storage($storageName); |
28 | - } catch(StorageException $e) { |
|
28 | + } catch (StorageException $e) { |
|
29 | 29 | handle($e); |
30 | 30 | } |
31 | 31 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function isDirectory($key) |
158 | 158 | { |
159 | - if($this->supportsDirectories()){ |
|
159 | + if ($this->supportsDirectories()) { |
|
160 | 160 | return true; |
161 | 161 | } |
162 | 162 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public function touchKey($key) |
176 | 176 | { |
177 | - if($this->supportsTouching()){ |
|
177 | + if ($this->supportsTouching()) { |
|
178 | 178 | return $this->getDriver()->touchKey($key); |
179 | 179 | } |
180 | 180 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | if ($this->supportsSize()) { |
193 | 193 | return $this->getDriver()->getSize($key); |
194 | 194 | } |
195 | - handle(new StorageException(StorageException::DRIVER_CAN_NOT_ACCESS_SIZE, [get_class($this->getDriver())])); |
|
195 | + handle(new StorageException(StorageException::DRIVER_CAN_NOT_ACCESS_SIZE, [ get_class($this->getDriver()) ])); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -26,24 +26,24 @@ discard block |
||
26 | 26 | */ |
27 | 27 | function __construct($diskName = null) |
28 | 28 | { |
29 | - if(strpos($diskName, '/') !== false) { |
|
29 | + if (strpos($diskName, '/') !== false) { |
|
30 | 30 | $this->disk = $this->validateDisk([ |
31 | 31 | 'root' => $diskName |
32 | 32 | ]); |
33 | 33 | } else { |
34 | - if($this->isDisk($diskName)) { |
|
34 | + if ($this->isDisk($diskName)) { |
|
35 | 35 | $this->disk = $this->validateDisk( |
36 | - Config::getInstance()->get("disks", "filesystem")[$diskName] |
|
36 | + Config::getInstance()->get("disks", "filesystem")[ $diskName ] |
|
37 | 37 | ); |
38 | 38 | } else { |
39 | 39 | handle(new StorageException(StorageException::DISK_NOT_FOUND)); |
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
43 | - if($this->isNull($this->disk['driver'])) |
|
44 | - $this->disk['driver'] = Config::getInstance()->get("default", "filesystem"); |
|
43 | + if ($this->isNull($this->disk[ 'driver' ])) |
|
44 | + $this->disk[ 'driver' ] = Config::getInstance()->get("default", "filesystem"); |
|
45 | 45 | |
46 | - if($this->disk['driver'] == 'local') { |
|
46 | + if ($this->disk[ 'driver' ] == 'local') { |
|
47 | 47 | $this->Driver = new LocalStorageDriver($this->disk); |
48 | 48 | } |
49 | 49 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function isDisk($diskName) |
58 | 58 | { |
59 | - if(!$this->isNull(Config::getInstance()->get("disks", "filesystem")[$diskName])) { |
|
59 | + if (!$this->isNull(Config::getInstance()->get("disks", "filesystem")[ $diskName ])) { |
|
60 | 60 | return true; |
61 | 61 | } else { |
62 | 62 | return false; |
@@ -83,16 +83,16 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function getPath() |
85 | 85 | { |
86 | - return $this->disk['root']; |
|
86 | + return $this->disk[ 'root' ]; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | private function validateDisk($conf) |
90 | 90 | { |
91 | - if(!array_key_exists('driver', $conf)) |
|
92 | - $conf['driver'] = null; |
|
91 | + if (!array_key_exists('driver', $conf)) |
|
92 | + $conf[ 'driver' ] = null; |
|
93 | 93 | |
94 | - if(!array_key_exists('root', $conf)) |
|
95 | - $conf['root'] = null; |
|
94 | + if (!array_key_exists('root', $conf)) |
|
95 | + $conf[ 'root' ] = null; |
|
96 | 96 | |
97 | 97 | return $conf; |
98 | 98 | } |
@@ -40,8 +40,9 @@ discard block |
||
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
43 | - if($this->isNull($this->disk['driver'])) |
|
44 | - $this->disk['driver'] = Config::getInstance()->get("default", "filesystem"); |
|
43 | + if($this->isNull($this->disk['driver'])) { |
|
44 | + $this->disk['driver'] = Config::getInstance()->get("default", "filesystem"); |
|
45 | + } |
|
45 | 46 | |
46 | 47 | if($this->disk['driver'] == 'local') { |
47 | 48 | $this->Driver = new LocalStorageDriver($this->disk); |
@@ -88,11 +89,13 @@ discard block |
||
88 | 89 | |
89 | 90 | private function validateDisk($conf) |
90 | 91 | { |
91 | - if(!array_key_exists('driver', $conf)) |
|
92 | - $conf['driver'] = null; |
|
92 | + if(!array_key_exists('driver', $conf)) { |
|
93 | + $conf['driver'] = null; |
|
94 | + } |
|
93 | 95 | |
94 | - if(!array_key_exists('root', $conf)) |
|
95 | - $conf['root'] = null; |
|
96 | + if(!array_key_exists('root', $conf)) { |
|
97 | + $conf['root'] = null; |
|
98 | + } |
|
96 | 99 | |
97 | 100 | return $conf; |
98 | 101 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | class Directory implements DirectoryInterface, \IteratorAggregate |
18 | 18 | { |
19 | - use StdLibTrait,EventManagerTrait; |
|
19 | + use StdLibTrait, EventManagerTrait; |
|
20 | 20 | |
21 | 21 | protected $key; |
22 | 22 | protected $storage; |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function __construct($key, Storage $storage, $recursive = false, $filter = null) |
38 | 38 | { |
39 | - if(!$storage->supportsDirectories()){ |
|
39 | + if (!$storage->supportsDirectories()) { |
|
40 | 40 | $driver = get_class($storage->getDriver()); |
41 | - handle(new StorageException(StorageException::DRIVER_CAN_NOT_WORK_WITH_DIRECTORIES, [$driver])); |
|
41 | + handle(new StorageException(StorageException::DRIVER_CAN_NOT_WORK_WITH_DIRECTORIES, [ $driver ])); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | $this->key = $key; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $this->storage = $storage; |
47 | 47 | |
48 | 48 | if ($this->storage->keyExists($key) && !$this->storage->isDirectory($key)) { |
49 | - handle(new StorageException(StorageException::DIRECTORY_OBJECT_CAN_NOT_READ_FILE_PATHS, [$key])); |
|
49 | + handle(new StorageException(StorageException::DIRECTORY_OBJECT_CAN_NOT_READ_FILE_PATHS, [ $key ])); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | $this->parseFilter($filter); |
@@ -196,10 +196,10 @@ discard block |
||
196 | 196 | $filter = $this->str($filter); |
197 | 197 | if ($filter->startsWith('*')) { |
198 | 198 | $filter->replace('.', '\.'); |
199 | - $this->regex = '/(\S+)' . $filter . '/'; |
|
199 | + $this->regex = '/(\S+)'.$filter.'/'; |
|
200 | 200 | } elseif ($filter->endsWith('*')) { |
201 | 201 | $filter->replace('.', '\.'); |
202 | - $this->regex = '/' . $filter . '(\S+)/'; |
|
202 | + $this->regex = '/'.$filter.'(\S+)/'; |
|
203 | 203 | } else { |
204 | 204 | $this->regex = $filter; |
205 | 205 | } |
@@ -214,17 +214,17 @@ discard block |
||
214 | 214 | if ($this->regex) { |
215 | 215 | foreach ($keys as $k => $v) { |
216 | 216 | if (!preg_match($this->regex, $v)) { |
217 | - unset($keys[$k]); |
|
217 | + unset($keys[ $k ]); |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 | } |
221 | 221 | // Instantiate files/directories |
222 | - $this->items = []; |
|
222 | + $this->items = [ ]; |
|
223 | 223 | foreach ($keys as $key) { |
224 | 224 | if ($this->storage->isDirectory($key)) { |
225 | - $this->items[$key] = new static($key, $this->storage); |
|
225 | + $this->items[ $key ] = new static($key, $this->storage); |
|
226 | 226 | } else { |
227 | - $this->items[$key] = new File($key, $this->storage); |
|
227 | + $this->items[ $key ] = new File($key, $this->storage); |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | } |
@@ -35,8 +35,8 @@ |
||
35 | 35 | $this->key = $key; |
36 | 36 | |
37 | 37 | //make sure a file path is given |
38 | - if($this->storage->keyExists($this->key) && $this->getStorage()->isDirectory($this->key)){ |
|
39 | - handle(new StorageException(StorageException::FILE_NOT_FOUND, [$key])); |
|
38 | + if ($this->storage->keyExists($this->key) && $this->getStorage()->isDirectory($this->key)) { |
|
39 | + handle(new StorageException(StorageException::FILE_NOT_FOUND, [ $key ])); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 |
@@ -61,15 +61,17 @@ discard block |
||
61 | 61 | $i = 0; |
62 | 62 | foreach($View as $key => $value){ |
63 | 63 | if($key === "paths"){ |
64 | - if($i <= 0) |
|
65 | - $this->TemplateEngine->setTemplateDir($value); |
|
66 | - else |
|
67 | - $this->TemplateEngine->addTemplateDir($value); |
|
64 | + if($i <= 0) { |
|
65 | + $this->TemplateEngine->setTemplateDir($value); |
|
66 | + } else { |
|
67 | + $this->TemplateEngine->addTemplateDir($value); |
|
68 | + } |
|
68 | 69 | } else { |
69 | - if($i <= 0) |
|
70 | - $this->TemplateEngine->setTemplateDir($value->getAbsolutePath()); |
|
71 | - else |
|
72 | - $this->TemplateEngine->addTemplateDir($value->getAbsolutePath()); |
|
70 | + if($i <= 0) { |
|
71 | + $this->TemplateEngine->setTemplateDir($value->getAbsolutePath()); |
|
72 | + } else { |
|
73 | + $this->TemplateEngine->addTemplateDir($value->getAbsolutePath()); |
|
74 | + } |
|
73 | 75 | } |
74 | 76 | $i++; |
75 | 77 | } |
@@ -130,8 +132,9 @@ discard block |
||
130 | 132 | |
131 | 133 | private function getPathFromConfig($config) |
132 | 134 | { |
133 | - if(!is_array($config)) |
|
134 | - $config = array($config); |
|
135 | + if(!is_array($config)) { |
|
136 | + $config = array($config); |
|
137 | + } |
|
135 | 138 | |
136 | 139 | $View = false; |
137 | 140 | foreach($config as $path){ |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | private $TemplateEngine; |
44 | 44 | |
45 | - function __construct($view = null, $data = []) |
|
45 | + function __construct($view = null, $data = [ ]) |
|
46 | 46 | { |
47 | 47 | $this->view = self::validateViewName($view); |
48 | 48 | $this->data = $data; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $this->TemplateEngine = $TE->getInstance(); |
52 | 52 | |
53 | 53 | // set Config path |
54 | - $this->TemplateEngine->setCompileDir($this->getPathFromConfig(Config::getInstance()->get("compiled", "view"))[0]->getAbsolutePath()); |
|
54 | + $this->TemplateEngine->setCompileDir($this->getPathFromConfig(Config::getInstance()->get("compiled", "view"))[ 0 ]->getAbsolutePath()); |
|
55 | 55 | |
56 | 56 | // get view paths |
57 | 57 | $config = Config::getInstance()->get("paths", "view"); |
@@ -59,14 +59,14 @@ discard block |
||
59 | 59 | |
60 | 60 | // add view paths |
61 | 61 | $i = 0; |
62 | - foreach($View as $key => $value){ |
|
63 | - if($key === "paths"){ |
|
64 | - if($i <= 0) |
|
62 | + foreach ($View as $key => $value) { |
|
63 | + if ($key === "paths") { |
|
64 | + if ($i <= 0) |
|
65 | 65 | $this->TemplateEngine->setTemplateDir($value); |
66 | 66 | else |
67 | 67 | $this->TemplateEngine->addTemplateDir($value); |
68 | 68 | } else { |
69 | - if($i <= 0) |
|
69 | + if ($i <= 0) |
|
70 | 70 | $this->TemplateEngine->setTemplateDir($value->getAbsolutePath()); |
71 | 71 | else |
72 | 72 | $this->TemplateEngine->addTemplateDir($value->getAbsolutePath()); |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | $this->assignData($this->data); |
88 | 88 | |
89 | 89 | $expView = explode(":", $this->view); |
90 | - if(!array_key_exists(1, $expView)) { |
|
90 | + if (!array_key_exists(1, $expView)) { |
|
91 | 91 | $this->TemplateEngine->display($this->view); |
92 | - } elseif($expView[0] == "fetch") { |
|
93 | - return $this->TemplateEngine->fetch(self::validateViewName($expView[1])); |
|
92 | + } elseif ($expView[ 0 ] == "fetch") { |
|
93 | + return $this->TemplateEngine->fetch(self::validateViewName($expView[ 1 ])); |
|
94 | 94 | } |
95 | - } catch(\Exception $e) { |
|
95 | + } catch (\Exception $e) { |
|
96 | 96 | handle($e); |
97 | 97 | } |
98 | 98 | } |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | private function assignData($data) |
101 | 101 | { |
102 | 102 | foreach ($data as $valueName => $dataSet) { |
103 | - if(is_string($dataSet) && array_key_exists(1, explode(":", $dataSet))){ |
|
104 | - $viewName = explode(":", $dataSet)[1]; |
|
103 | + if (is_string($dataSet) && array_key_exists(1, explode(":", $dataSet))) { |
|
104 | + $viewName = explode(":", $dataSet)[ 1 ]; |
|
105 | 105 | |
106 | - switch (explode(":", $dataSet)[0]) { |
|
106 | + switch (explode(":", $dataSet)[ 0 ]) { |
|
107 | 107 | case "fetch": |
108 | 108 | $this->TemplateEngine->assign($valueName, $this->TemplateEngine->fetch(self::validateViewName($viewName))); |
109 | 109 | break; |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | private static function validateViewName($view) |
123 | 123 | { |
124 | - if(!array_key_exists(1, explode(".", $view))){ |
|
124 | + if (!array_key_exists(1, explode(".", $view))) { |
|
125 | 125 | return $view.".tpl"; |
126 | 126 | } else { |
127 | 127 | return $view; |
@@ -130,16 +130,16 @@ discard block |
||
130 | 130 | |
131 | 131 | private function getPathFromConfig($config) |
132 | 132 | { |
133 | - if(!is_array($config)) |
|
133 | + if (!is_array($config)) |
|
134 | 134 | $config = array($config); |
135 | 135 | |
136 | 136 | $View = false; |
137 | - foreach($config as $path){ |
|
137 | + foreach ($config as $path) { |
|
138 | 138 | $path = explode(":", $path); |
139 | - if($path[0] == "disk"){ |
|
140 | - $View[] = new Storage($path[1]); |
|
139 | + if ($path[ 0 ] == "disk") { |
|
140 | + $View[ ] = new Storage($path[ 1 ]); |
|
141 | 141 | } else { |
142 | - $View["paths"] = $path; |
|
142 | + $View[ "paths" ] = $path; |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | return $View; |