@@ -15,14 +15,14 @@ |
||
15 | 15 | |
16 | 16 | private function setConsts() |
17 | 17 | { |
18 | - if (! defined('DS')) { |
|
18 | + if (!defined('DS')) { |
|
19 | 19 | define('DS', DIRECTORY_SEPARATOR); |
20 | 20 | } |
21 | 21 | } |
22 | 22 | |
23 | 23 | private function registerFacade() |
24 | 24 | { |
25 | - $this->app->bind('filesystem',function() { |
|
25 | + $this->app->bind('filesystem', function() { |
|
26 | 26 | return new FileSystem(); |
27 | 27 | }); |
28 | 28 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | { |
18 | 18 | $func = 'get' . ucfirst($name); |
19 | 19 | |
20 | - if (! method_exists($this, $func)) { |
|
20 | + if (!method_exists($this, $func)) { |
|
21 | 21 | throw new \Exception("Has not attribute in class"); |
22 | 22 | } |
23 | 23 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | private function setLocation(string $location) : FileHandler |
42 | 42 | { |
43 | - if (! strlen($location)) { |
|
43 | + if (!strlen($location)) { |
|
44 | 44 | throw new \Exception('Folder not defined.'); |
45 | 45 | } |
46 | 46 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | private function setName(string $name) : FileHandler |
58 | 58 | { |
59 | - if (! strlen($name)) { |
|
59 | + if (!strlen($name)) { |
|
60 | 60 | throw new \Exception('File name not defined.'); |
61 | 61 | } |
62 | 62 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | return $this; |
88 | 88 | |
89 | 89 | } catch (\Exception $e) { |
90 | - throw new Exception('Error to create file: '.$e->getMessage()); |
|
90 | + throw new Exception('Error to create file: ' . $e->getMessage()); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | |
103 | 103 | $location = $this->getLocation(); |
104 | 104 | |
105 | - if (! is_dir($location)) { |
|
105 | + if (!is_dir($location)) { |
|
106 | 106 | mkdir($location, $this->permission, true); |
107 | 107 | } |
108 | 108 | |
109 | 109 | return $this; |
110 | 110 | |
111 | 111 | } catch (\Exception $e) { |
112 | - throw new Exception("Error to create folder: ". $e->getMessage()); |
|
112 | + throw new Exception("Error to create folder: " . $e->getMessage()); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | private function analizeFilename() : FileHandler |
160 | 160 | { |
161 | - if (! str_contains($this->name, '/')) { |
|
161 | + if (!str_contains($this->name, '/')) { |
|
162 | 162 | return $this; |
163 | 163 | } |
164 | 164 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | { |
30 | 30 | $this->initStructure()->setName($name); |
31 | 31 | |
32 | - if (! $this->exists()) { |
|
32 | + if (!$this->exists()) { |
|
33 | 33 | return $this; |
34 | 34 | } |
35 | 35 | |
@@ -154,6 +154,6 @@ discard block |
||
154 | 154 | |
155 | 155 | $cached = Cache::get($name); |
156 | 156 | |
157 | - return (! $cached) ? false : true; |
|
157 | + return (!$cached) ? false : true; |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | \ No newline at end of file |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function root(string $path = null) |
39 | 39 | { |
40 | - return (! $path) ? $this->getRoot() : $this->setRoot($path); |
|
40 | + return (!$path) ? $this->getRoot() : $this->setRoot($path); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function template(string $path = null) |
74 | 74 | { |
75 | - return (! $path) ? $this->getTemplate() : $this->setTemplate($path); |
|
75 | + return (!$path) ? $this->getTemplate() : $this->setTemplate($path); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function paths(array $paths = null) |
124 | 124 | { |
125 | - if (! $paths) { |
|
125 | + if (!$paths) { |
|
126 | 126 | return $this->getPaths(); |
127 | 127 | } |
128 | 128 |
@@ -89,7 +89,7 @@ |
||
89 | 89 | { |
90 | 90 | $structure = $this->getStructureDirectory(); |
91 | 91 | |
92 | - foreach($structure as $key => $path) |
|
92 | + foreach ($structure as $key => $path) |
|
93 | 93 | { |
94 | 94 | if ($key == '*') { |
95 | 95 | return $path; |
@@ -40,8 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function name(string $name = null) |
42 | 42 | { |
43 | - return (! $name) ? $this->getName() : |
|
44 | - $this->setName($name); |
|
43 | + return (!$name) ? $this->getName() : $this->setName($name); |
|
45 | 44 | } |
46 | 45 | |
47 | 46 | /** |
@@ -74,8 +73,7 @@ discard block |
||
74 | 73 | */ |
75 | 74 | public function folder(string $folder = null) |
76 | 75 | { |
77 | - return (! $folder) ? $this->getFolder() : |
|
78 | - $this->setFolder($folder); |
|
76 | + return (!$folder) ? $this->getFolder() : $this->setFolder($folder); |
|
79 | 77 | } |
80 | 78 | |
81 | 79 | /** |
@@ -108,7 +106,7 @@ discard block |
||
108 | 106 | */ |
109 | 107 | private function initHandler() : FileHandler |
110 | 108 | { |
111 | - if (! $this->folder || ! $this->name) { |
|
109 | + if (!$this->folder || !$this->name) { |
|
112 | 110 | throw new \Exception("Error Processing Request"); |
113 | 111 | } |
114 | 112 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function files(string $pattern = null) : array |
30 | 30 | { |
31 | - $pattern = "/". $pattern ."/"; |
|
31 | + $pattern = "/" . $pattern . "/"; |
|
32 | 32 | |
33 | 33 | $this->scan($this->path(), $pattern); |
34 | 34 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | private function setPath(string $path) : FileSearch |
100 | 100 | { |
101 | - if (! is_dir($path)) { |
|
101 | + if (!is_dir($path)) { |
|
102 | 102 | throw new Exception('Path not found.'); |
103 | 103 | } |
104 | 104 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | static public function read(string $path, int $level) : array |
10 | 10 | { |
11 | - if (! is_dir($path)) return []; |
|
11 | + if (!is_dir($path)) return []; |
|
12 | 12 | |
13 | 13 | self::scan($path, 1, $level); |
14 | 14 | |
@@ -31,18 +31,18 @@ discard block |
||
31 | 31 | |
32 | 32 | static private function scan(string $path, int $step, int $level) : void |
33 | 33 | { |
34 | - $items = array_diff(scandir($path), array('.', '..')); |
|
34 | + $items = array_diff(scandir($path), array('.', '..')); |
|
35 | 35 | |
36 | - foreach($items as $item) { |
|
36 | + foreach ($items as $item) { |
|
37 | 37 | |
38 | 38 | $folder = "$path/$item"; |
39 | 39 | |
40 | - if (! is_dir($folder)) { |
|
40 | + if (!is_dir($folder)) { |
|
41 | 41 | continue; |
42 | 42 | } |
43 | 43 | |
44 | 44 | if (is_dir($folder) && $step < $level) { |
45 | - self::scan($folder, $step+1, $level); |
|
45 | + self::scan($folder, $step + 1, $level); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | if ($step == $level) { |