@@ -66,8 +66,8 @@ |
||
| 66 | 66 | if (false !== ($exceptionKey = array_search('Exception', $classNameParts)) OR
|
| 67 | 67 | false !== ($exceptionKey = array_search('Exceptions', $classNameParts))
|
| 68 | 68 | ) {
|
| 69 | - if (isset($classNameParts[ $exceptionKey - 1 ])) {
|
|
| 70 | - $classParameter = $classNameParts[ $exceptionKey - 1 ]; |
|
| 69 | + if (isset($classNameParts[$exceptionKey - 1])) {
|
|
| 70 | + $classParameter = $classNameParts[$exceptionKey - 1]; |
|
| 71 | 71 | |
| 72 | 72 | } |
| 73 | 73 | } |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | * @param $className |
| 17 | 17 | */ |
| 18 | 18 | spl_autoload_register( |
| 19 | - function ($className) {
|
|
| 19 | + function($className) {
|
|
| 20 | 20 | if (strpos($className, 'O2System\Spl\\') === false) {
|
| 21 | 21 | return; |
| 22 | 22 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function attach($offset, \Closure $closure) |
| 45 | 45 | {
|
| 46 | - $this->closures[ $offset ] = $closure; |
|
| 46 | + $this->closures[$offset] = $closure; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | // ------------------------------------------------------------------------ |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | public function has($offset) |
| 78 | 78 | {
|
| 79 | - return (bool)isset($this->closures[ $offset ]); |
|
| 79 | + return (bool)isset($this->closures[$offset]); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | // ------------------------------------------------------------------------ |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | public function detach($offset) |
| 107 | 107 | {
|
| 108 | - if (isset($this->closures[ $offset ])) {
|
|
| 109 | - unset($this->closures[ $offset ]); |
|
| 108 | + if (isset($this->closures[$offset])) {
|
|
| 109 | + unset($this->closures[$offset]); |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | |
@@ -142,8 +142,8 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public function get($offset, array $arguments = []) |
| 144 | 144 | {
|
| 145 | - return isset($this->closures[ $offset ]) ? call_user_func_array( |
|
| 146 | - $this->closures[ $offset ], |
|
| 145 | + return isset($this->closures[$offset]) ? call_user_func_array( |
|
| 146 | + $this->closures[$offset], |
|
| 147 | 147 | $arguments |
| 148 | 148 | ) : false; |
| 149 | 149 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function getParentRelativePath() |
| 104 | 104 | {
|
| 105 | - $scriptFilename = str_replace(['/', '\\'], '/', dirname($_SERVER[ 'SCRIPT_FILENAME' ])); |
|
| 105 | + $scriptFilename = str_replace(['/', '\\'], '/', dirname($_SERVER['SCRIPT_FILENAME'])); |
|
| 106 | 106 | $relativePath = str_replace(['/', '\\'], '/', dirname($this->pathName)) . '/'; |
| 107 | 107 | |
| 108 | 108 | if (strpos($scriptFilename, 'public')) {
|
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | public function getRelativePath() |
| 197 | 197 | {
|
| 198 | - $scriptFilename = str_replace(['/', '\\'], '/', dirname($_SERVER[ 'SCRIPT_FILENAME' ])); |
|
| 198 | + $scriptFilename = str_replace(['/', '\\'], '/', dirname($_SERVER['SCRIPT_FILENAME'])); |
|
| 199 | 199 | $relativePath = str_replace(['/', '\\'], '/', $this->pathName); |
| 200 | 200 | |
| 201 | 201 | if (strpos($scriptFilename, 'public')) {
|
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | |
| 437 | 437 | foreach ($directoryIterator as $directoryNode) {
|
| 438 | 438 | if ($directoryNode->isDir() AND $directoryNode->isDot() === false) {
|
| 439 | - $tree[ $directoryNode->getFilename() ] = (new SplDirectoryInfo( |
|
| 439 | + $tree[$directoryNode->getFilename()] = (new SplDirectoryInfo( |
|
| 440 | 440 | $directoryNode->getPathName() |
| 441 | 441 | ))->getTree(); |
| 442 | 442 | } elseif ($directoryNode->isFile()) {
|
@@ -40,14 +40,14 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function addConfig($key, $value) |
| 42 | 42 | {
|
| 43 | - if (isset($this->config[ $key ])) {
|
|
| 44 | - if (is_array($value) AND is_array($this->config[ $key ])) {
|
|
| 45 | - $this->config[ $key ] = array_merge($this->config[ $key ], $value); |
|
| 43 | + if (isset($this->config[$key])) {
|
|
| 44 | + if (is_array($value) AND is_array($this->config[$key])) {
|
|
| 45 | + $this->config[$key] = array_merge($this->config[$key], $value); |
|
| 46 | 46 | } else {
|
| 47 | - $this->config[ $key ] = $value; |
|
| 47 | + $this->config[$key] = $value; |
|
| 48 | 48 | } |
| 49 | 49 | } else {
|
| 50 | - $this->config[ $key ] = $value; |
|
| 50 | + $this->config[$key] = $value; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | return $this; |
@@ -68,12 +68,12 @@ discard block |
||
| 68 | 68 | final public function getConfig($key = null, $offset = null) |
| 69 | 69 | {
|
| 70 | 70 | if (isset($key)) {
|
| 71 | - if (isset($this->config[ $key ])) {
|
|
| 71 | + if (isset($this->config[$key])) {
|
|
| 72 | 72 | if (isset($offset)) {
|
| 73 | - return isset($this->config[ $key ][ $offset ]) ? $this->config[ $key ][ $offset ] : null; |
|
| 73 | + return isset($this->config[$key][$offset]) ? $this->config[$key][$offset] : null; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - return $this->config[ $key ]; |
|
| 76 | + return $this->config[$key]; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | return false; |
@@ -103,14 +103,14 @@ discard block |
||
| 103 | 103 | } |
| 104 | 104 | } elseif ($key instanceof Config) {
|
| 105 | 105 | $this->config = $key; |
| 106 | - } elseif (isset($this->config[ $key ])) {
|
|
| 107 | - if (is_array($value) AND is_array($this->config[ $key ])) {
|
|
| 108 | - $this->config[ $key ] = array_merge($this->config[ $key ], $value); |
|
| 106 | + } elseif (isset($this->config[$key])) {
|
|
| 107 | + if (is_array($value) AND is_array($this->config[$key])) {
|
|
| 108 | + $this->config[$key] = array_merge($this->config[$key], $value); |
|
| 109 | 109 | } else {
|
| 110 | - $this->config[ $key ] = $value; |
|
| 110 | + $this->config[$key] = $value; |
|
| 111 | 111 | } |
| 112 | 112 | } else {
|
| 113 | - $this->config[ $key ] = $value; |
|
| 113 | + $this->config[$key] = $value; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | return $this; |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | public function removeFilePath($filePath) |
| 51 | 51 | {
|
| 52 | 52 | if (false !== ($key = array_search($filePath, $this->filePaths))) {
|
| 53 | - unset($this->filePaths[ $key ]); |
|
| 53 | + unset($this->filePaths[$key]); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | return $this; |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | if (is_dir($filePath) AND ! in_array($filePath, $this->filePaths)) {
|
| 105 | 105 | if (isset($offset)) {
|
| 106 | - $this->filePaths[ $offset ] = $filePath; |
|
| 106 | + $this->filePaths[$offset] = $filePath; |
|
| 107 | 107 | } else {
|
| 108 | 108 | $this->filePaths[] = $filePath; |
| 109 | 109 | } |
@@ -98,6 +98,6 @@ |
||
| 98 | 98 | */ |
| 99 | 99 | protected function addError($code, $message) |
| 100 | 100 | {
|
| 101 | - $this->errors[ $code ] = $message; |
|
| 101 | + $this->errors[$code] = $message; |
|
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | \ No newline at end of file |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function attach($offset, SplServiceRegistry $service) |
| 46 | 46 | {
|
| 47 | - $this->services[ $offset ] = $service; |
|
| 47 | + $this->services[$offset] = $service; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | // ------------------------------------------------------------------------ |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function detach($offset) |
| 75 | 75 | {
|
| 76 | - if (isset($this->services[ $offset ])) {
|
|
| 77 | - unset($this->services[ $offset ]); |
|
| 76 | + if (isset($this->services[$offset])) {
|
|
| 77 | + unset($this->services[$offset]); |
|
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function has($offset) |
| 110 | 110 | {
|
| 111 | - return (bool)isset($this->services[ $offset ]); |
|
| 111 | + return (bool)isset($this->services[$offset]); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | // ------------------------------------------------------------------------ |
@@ -125,9 +125,9 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public function &__get($offset) |
| 127 | 127 | {
|
| 128 | - $get[ $offset ] = $this->get($offset); |
|
| 128 | + $get[$offset] = $this->get($offset); |
|
| 129 | 129 | |
| 130 | - return $get[ $offset ]; |
|
| 130 | + return $get[$offset]; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | // ------------------------------------------------------------------------ |
@@ -144,10 +144,10 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | public function &get($offset, array $arguments = []) |
| 146 | 146 | {
|
| 147 | - $get[ $offset ] = false; |
|
| 147 | + $get[$offset] = false; |
|
| 148 | 148 | |
| 149 | 149 | if ($this->has($offset)) {
|
| 150 | - $service = $this->services[ $offset ]; |
|
| 150 | + $service = $this->services[$offset]; |
|
| 151 | 151 | |
| 152 | 152 | if ($service instanceof SplServiceRegistry) {
|
| 153 | 153 | if (empty($arguments)) {
|
@@ -162,24 +162,24 @@ discard block |
||
| 162 | 162 | if ($DocComment = $service->getDocComment()) {
|
| 163 | 163 | preg_match_all('/@inject\s(.*)/', $DocComment, $matches);
|
| 164 | 164 | |
| 165 | - if (count($matches[ 1 ])) {
|
|
| 166 | - foreach ($matches[ 1 ] as $className) {
|
|
| 165 | + if (count($matches[1])) {
|
|
| 166 | + foreach ($matches[1] as $className) {
|
|
| 167 | 167 | $className = trim($className, '\\'); |
| 168 | 168 | $className = trim($className); |
| 169 | 169 | |
| 170 | 170 | $map = strtolower(get_class_name($className)); |
| 171 | 171 | |
| 172 | - if (isset($this->map[ $className ])) {
|
|
| 173 | - $map = $this->map[ $className ]; |
|
| 172 | + if (isset($this->map[$className])) {
|
|
| 173 | + $map = $this->map[$className]; |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | $variable = $map; |
| 177 | - $object =& $this->get($map); |
|
| 177 | + $object = & $this->get($map); |
|
| 178 | 178 | |
| 179 | 179 | preg_match_all('/[$](.*)\s(.*)/', trim($className), $classMatches);
|
| 180 | 180 | |
| 181 | - if (count($classMatches[ 1 ])) {
|
|
| 182 | - $variable = $classMatches[ 1 ][ 0 ]; |
|
| 181 | + if (count($classMatches[1])) {
|
|
| 182 | + $variable = $classMatches[1][0]; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | $setterMethod = ucwords(str_replace(['-', '_'], ' ', $variable)); |
@@ -191,18 +191,18 @@ discard block |
||
| 191 | 191 | } elseif (method_exists($newServiceInstance, '__set')) {
|
| 192 | 192 | $newServiceInstance->__set($variable, $object); |
| 193 | 193 | } else {
|
| 194 | - $newServiceInstance->{$variable} =& $object;
|
|
| 194 | + $newServiceInstance->{$variable} = & $object;
|
|
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - $get[ $offset ] = $newServiceInstance; |
|
| 200 | + $get[$offset] = $newServiceInstance; |
|
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - return $get[ $offset ]; |
|
| 205 | + return $get[$offset]; |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | // ------------------------------------------------------------------------ |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function __isset($offset) |
| 53 | 53 | {
|
| 54 | - return isset($this->storage[ $offset ]); |
|
| 54 | + return isset($this->storage[$offset]); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | // ------------------------------------------------------------------------ |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function __unset($offset) |
| 71 | 71 | {
|
| 72 | - unset($this->storage[ $offset ]); |
|
| 72 | + unset($this->storage[$offset]); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | // ------------------------------------------------------------------------ |
@@ -126,11 +126,11 @@ discard block |
||
| 126 | 126 | public function offsetGet($offset) |
| 127 | 127 | {
|
| 128 | 128 | if ($this->offsetExists($offset)) {
|
| 129 | - return $this->storage[ $offset ]; |
|
| 129 | + return $this->storage[$offset]; |
|
| 130 | 130 | } else {
|
| 131 | - $this->storage[ $offset ] = []; |
|
| 131 | + $this->storage[$offset] = []; |
|
| 132 | 132 | |
| 133 | - return $this->storage[ $offset ]; |
|
| 133 | + return $this->storage[$offset]; |
|
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | public function offsetExists($offset) |
| 157 | 157 | {
|
| 158 | - return (bool)isset($this->storage[ $offset ]); |
|
| 158 | + return (bool)isset($this->storage[$offset]); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | // ------------------------------------------------------------------------ |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | public function offsetSet($offset, $value) |
| 181 | 181 | {
|
| 182 | - $this->storage[ $offset ] = $value; |
|
| 182 | + $this->storage[$offset] = $value; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | // ------------------------------------------------------------------------ |
@@ -200,8 +200,8 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | public function offsetUnset($offset) |
| 202 | 202 | {
|
| 203 | - if (isset($this->storage[ $offset ])) {
|
|
| 204 | - unset($this->storage[ $offset ]); |
|
| 203 | + if (isset($this->storage[$offset])) {
|
|
| 204 | + unset($this->storage[$offset]); |
|
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | return filter_var_array($offset, $filter); |
| 227 | 227 | } elseif (is_array($storage) AND isset($filter)) {
|
| 228 | 228 | foreach ($storage as $key => $value) {
|
| 229 | - $storage[ $key ] = filter_var($value, $filter); |
|
| 229 | + $storage[$key] = filter_var($value, $filter); |
|
| 230 | 230 | } |
| 231 | 231 | } elseif (isset($filter)) {
|
| 232 | 232 | return filter_var($storage, $filter); |