@@ -41,13 +41,13 @@ |
||
41 | 41 | { |
42 | 42 | return (1 < count($this->path)) |
43 | 43 | ? Stuff::arrayToPath(array_slice($this->path, 0, -1)) |
44 | - : '' ; |
|
44 | + : ''; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | public function getFileName(): string |
48 | 48 | { |
49 | 49 | return (0 < count($this->path)) |
50 | 50 | ? end($this->path) |
51 | - : '' ; |
|
51 | + : ''; |
|
52 | 52 | } |
53 | 53 | } |
@@ -77,9 +77,9 @@ |
||
77 | 77 | { |
78 | 78 | try { |
79 | 79 | $target = empty($path) ? '' : Stuff::removeEndingSlash($path) . DIRECTORY_SEPARATOR; |
80 | - $targetPath = $target . $name ; |
|
80 | + $targetPath = $target . $name; |
|
81 | 81 | return mkdir($this->webRootDir . $targetPath) |
82 | - && ( $makeExtra ? $this->makeExtended($targetPath) : true ); |
|
82 | + && ($makeExtra ? $this->makeExtended($targetPath) : true); |
|
83 | 83 | // @codeCoverageIgnoreStart |
84 | 84 | } catch (Error $ex) { |
85 | 85 | throw new PathsException($ex->getMessage(), $ex->getCode(), $ex); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | public static function directory(string $path): string |
76 | 76 | { |
77 | 77 | $pos = mb_strrpos($path, DIRECTORY_SEPARATOR); |
78 | - return (false !== $pos) ? mb_substr($path, 0, $pos + 1) : '' ; |
|
78 | + return (false !== $pos) ? mb_substr($path, 0, $pos + 1) : ''; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | public static function filename(string $path): string |
88 | 88 | { |
89 | 89 | $pos = mb_strrpos($path, DIRECTORY_SEPARATOR); |
90 | - return (false !== $pos) ? mb_substr($path, $pos + 1) : $path ; |
|
90 | + return (false !== $pos) ? mb_substr($path, $pos + 1) : $path; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | public static function fileBase(string $path): string |
99 | 99 | { |
100 | 100 | $pos = mb_strrpos($path, IPaths::SPLITTER_DOT); |
101 | - return (false !== $pos) && (0 < $pos) ? mb_substr($path, 0, $pos) : $path ; |
|
101 | + return (false !== $pos) && (0 < $pos) ? mb_substr($path, 0, $pos) : $path; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | public static function fileExt(string $path): string |
110 | 110 | { |
111 | 111 | $pos = mb_strrpos($path, IPaths::SPLITTER_DOT); |
112 | - return ((false !== $pos) && (0 < $pos)) ? mb_substr($path, $pos + 1) : '' ; |
|
112 | + return ((false !== $pos) && (0 < $pos)) ? mb_substr($path, $pos + 1) : ''; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public static function removeEndingSlash(string $path): string |
121 | 121 | { |
122 | - return (DIRECTORY_SEPARATOR == mb_substr($path, -1, 1)) ? mb_substr($path, 0, -1) : $path ; |
|
122 | + return (DIRECTORY_SEPARATOR == mb_substr($path, -1, 1)) ? mb_substr($path, 0, -1) : $path; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -138,6 +138,6 @@ discard block |
||
138 | 138 | $base = static::fileBase($fName); |
139 | 139 | $extLen = strlen($ext); |
140 | 140 | $cut = substr($base, 0, ($maxLen - $extLen)); |
141 | - return ($extLen) ? $cut . IPaths::SPLITTER_DOT . $ext : $cut ; |
|
141 | + return ($extLen) ? $cut . IPaths::SPLITTER_DOT . $ext : $cut; |
|
142 | 142 | } |
143 | 143 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | const DIR_NO_SUB = '.'; # current dir |
23 | 23 | const FILE_INDEX = 'index.htm'; # basic file |
24 | 24 | const FILE_FAIL = 'index.htm'; # file to show on fail |
25 | - const EXT = '.php'; # file extension |
|
25 | + const EXT = '.php'; # file extension |
|
26 | 26 | |
27 | 27 | const SPLITTER_SLASH = '/'; # split path by slash |
28 | 28 | const SPLITTER_QUOTE = '?'; # split path by quote sign |
@@ -47,11 +47,11 @@ |
||
47 | 47 | { |
48 | 48 | list($path, $params) = $this->explodeInput($this->requestUri); |
49 | 49 | list($staticalPath, $virtualPrefix, $virtualParamPath) = $this->pathToSegments(urldecode($path), $this->virtualDir); |
50 | - $this->preset( array_merge( |
|
50 | + $this->preset(array_merge( |
|
51 | 51 | compact('staticalPath', 'virtualPrefix'), |
52 | 52 | $this->updateVirtualKeys($this->parseVirtualPath($virtualParamPath)), |
53 | 53 | $this->parseParamsToArray($params) |
54 | - ) ); |
|
54 | + )); |
|
55 | 55 | return $this; |
56 | 56 | } |
57 | 57 |
@@ -19,7 +19,7 @@ |
||
19 | 19 | { |
20 | 20 | public function set(IVariables $inputs, ?string $virtualDir = null): parent |
21 | 21 | { |
22 | - $requestUri = $inputs->getInArray('REQUEST_URI', [IEntry::SOURCE_SERVER, ] ); |
|
22 | + $requestUri = $inputs->getInArray('REQUEST_URI', [IEntry::SOURCE_SERVER, ]); |
|
23 | 23 | $entry = reset($requestUri); |
24 | 24 | return $this->setData($entry ? strval($entry) : '', $virtualDir); |
25 | 25 | } |
@@ -50,13 +50,13 @@ |
||
50 | 50 | */ |
51 | 51 | public function setData(array $params): self |
52 | 52 | { |
53 | - $this->user = strval($params['user'] ?? $this->user ); |
|
54 | - $this->lang = strval($params['lang'] ?? $this->lang ); |
|
55 | - $this->path = Stuff::arrayToPath(Stuff::linkToArray(strval($params['path'] ?? $this->path ))); |
|
56 | - $this->module = strval($params['module'] ?? $this->module ); |
|
53 | + $this->user = strval($params['user'] ?? $this->user); |
|
54 | + $this->lang = strval($params['lang'] ?? $this->lang); |
|
55 | + $this->path = Stuff::arrayToPath(Stuff::linkToArray(strval($params['path'] ?? $this->path))); |
|
56 | + $this->module = strval($params['module'] ?? $this->module); |
|
57 | 57 | $this->isSingle = isset($params['single']); |
58 | - $this->staticalPath = strval($params['staticalPath'] ?? $this->staticalPath ); |
|
59 | - $this->virtualPrefix = strval($params['virtualPrefix'] ?? $this->virtualPrefix ); |
|
58 | + $this->staticalPath = strval($params['staticalPath'] ?? $this->staticalPath); |
|
59 | + $this->virtualPrefix = strval($params['virtualPrefix'] ?? $this->virtualPrefix); |
|
60 | 60 | return $this; |
61 | 61 | } |
62 | 62 |
@@ -61,7 +61,7 @@ |
||
61 | 61 | |
62 | 62 | protected function getTargetDir(): string |
63 | 63 | { |
64 | - return realpath(implode(DIRECTORY_SEPARATOR, [__DIR__, '..', 'data', 'tree' ])) . DIRECTORY_SEPARATOR; |
|
64 | + return realpath(implode(DIRECTORY_SEPARATOR, [__DIR__, '..', 'data', 'tree'])) . DIRECTORY_SEPARATOR; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | protected function targetExists(string $path): bool |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | public function testBasics(): void |
39 | 39 | { |
40 | 40 | $lib = $this->getExtend(); |
41 | - $this->assertEquals(realpath(implode(DIRECTORY_SEPARATOR, [__DIR__, '..', 'data' ])) . DIRECTORY_SEPARATOR, $lib->getWebRootDir()); |
|
41 | + $this->assertEquals(realpath(implode(DIRECTORY_SEPARATOR, [__DIR__, '..', 'data'])) . DIRECTORY_SEPARATOR, $lib->getWebRootDir()); |
|
42 | 42 | $this->assertEquals('desc', $lib->getDescDir()); |
43 | 43 | $this->assertEquals('descr', $lib->getDescFile()); |
44 | 44 | $this->assertEquals('.txt', $lib->getDescExt()); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | protected function getExtend(): ExtendDir |
141 | 141 | { |
142 | 142 | return new ExtendDir( |
143 | - realpath(implode(DIRECTORY_SEPARATOR, [__DIR__, '..', 'data' ])) . DIRECTORY_SEPARATOR, |
|
143 | + realpath(implode(DIRECTORY_SEPARATOR, [__DIR__, '..', 'data'])) . DIRECTORY_SEPARATOR, |
|
144 | 144 | 'desc', |
145 | 145 | 'descr', |
146 | 146 | '.txt', |