@@ -55,7 +55,7 @@ |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | if (!method_exists($instance, $method)) { |
| 58 | - throw new RuntimeException('Call to non-existent method "' . $method . '" on facade instance'); |
|
| 58 | + throw new RuntimeException('Call to non-existent method "'.$method.'" on facade instance'); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | return static::$serviceContainer->call(array($instance, $method), $parameters); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $path = preg_replace($pattern, $replacement, $path); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - return '#/?^' . $path . '/?$#'; |
|
| 81 | + return '#/?^'.$path.'/?$#'; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -96,9 +96,9 @@ discard block |
||
| 96 | 96 | return $controller; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - return preg_replace_callback('/^(.)|-(.)/', function ($matches) {
|
|
| 99 | + return preg_replace_callback('/^(.)|-(.)/', function($matches) {
|
|
| 100 | 100 | return strtoupper($matches[1] ?: $matches[2]); |
| 101 | - }, $controller) . 'Controller'; |
|
| 101 | + }, $controller).'Controller'; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * @return string Action method name |
| 112 | 112 | */ |
| 113 | 113 | public static function prepareAction($action) {
|
| 114 | - return preg_replace_callback('/-(.)/', function ($matches) {
|
|
| 114 | + return preg_replace_callback('/-(.)/', function($matches) {
|
|
| 115 | 115 | return strtoupper($matches[1]); |
| 116 | 116 | }, $action); |
| 117 | 117 | } |
@@ -432,15 +432,15 @@ discard block |
||
| 432 | 432 | $controller = static::prepareController($route->controller); |
| 433 | 433 | |
| 434 | 434 | if ($route->namespace) {
|
| 435 | - $controller = $route->namespace . '\\' . $controller; |
|
| 435 | + $controller = $route->namespace.'\\'.$controller; |
|
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | if (class_exists($controller)) {
|
| 439 | 439 | $route->controller = $controller; |
| 440 | 440 | } |
| 441 | 441 | } else {
|
| 442 | - $namespace = $route->namespace ? $route->namespace . '\\' : ''; |
|
| 443 | - $route->controller = $namespace . $this->defaults['controller']; |
|
| 442 | + $namespace = $route->namespace ? $route->namespace.'\\' : ''; |
|
| 443 | + $route->controller = $namespace.$this->defaults['controller']; |
|
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | return $route; |
@@ -464,8 +464,8 @@ discard block |
||
| 464 | 464 | |
| 465 | 465 | if (method_exists($route->controller, $action)) {
|
| 466 | 466 | $route->action = $action; |
| 467 | - } else if (method_exists($route->controller, $action . 'Action')) {
|
|
| 468 | - $route->action = $action . 'Action'; |
|
| 467 | + } else if (method_exists($route->controller, $action.'Action')) {
|
|
| 468 | + $route->action = $action.'Action'; |
|
| 469 | 469 | } |
| 470 | 470 | } else {
|
| 471 | 471 | $route->action = $this->defaults['action']; |
@@ -678,7 +678,7 @@ discard block |
||
| 678 | 678 | $response = $this->dispatchCallable($request, $response, $callable, $arguments); |
| 679 | 679 | $this->unsubscribe($controller); |
| 680 | 680 | |
| 681 | - $response->header('X-Location: ' . $request->uri());
|
|
| 681 | + $response->header('X-Location: '.$request->uri());
|
|
| 682 | 682 | |
| 683 | 683 | return $response; |
| 684 | 684 | } |
@@ -712,11 +712,11 @@ discard block |
||
| 712 | 712 | * @return string |
| 713 | 713 | */ |
| 714 | 714 | public function generate($path, array $parameters = array()) {
|
| 715 | - return preg_replace_callback('#/(:[A-Za-z0-9_-]+(\??))#', function ($match) use ($parameters) {
|
|
| 715 | + return preg_replace_callback('#/(:[A-Za-z0-9_-]+(\??))#', function($match) use ($parameters) {
|
|
| 716 | 716 | $parameter = trim($match[1], '?:'); |
| 717 | 717 | |
| 718 | 718 | if ($parameter && isset($parameters[$parameter])) {
|
| 719 | - return '/' . $parameters[$parameter]; |
|
| 719 | + return '/'.$parameters[$parameter]; |
|
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | if ($parameter !== 'params' && $match[2] !== '?') {
|
@@ -761,7 +761,7 @@ discard block |
||
| 761 | 761 | * @return string |
| 762 | 762 | */ |
| 763 | 763 | public function url($name, array $parameters = array()) {
|
| 764 | - return $this->base . $this->path($name, $parameters); |
|
| 764 | + return $this->base.$this->path($name, $parameters); |
|
| 765 | 765 | } |
| 766 | 766 | |
| 767 | 767 | } |
@@ -104,7 +104,7 @@ |
||
| 104 | 104 | */ |
| 105 | 105 | public function registerExtensions($extensions) { |
| 106 | 106 | foreach ((array) $extensions as $extension) { |
| 107 | - $this->extensions[] = '.' . ltrim($extension, '.'); |
|
| 107 | + $this->extensions[] = '.'.ltrim($extension, '.'); |
|
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | * Normalise the given path. |
| 61 | 61 | * |
| 62 | 62 | * @param string $path |
| 63 | - * @return path |
|
| 63 | + * @return string |
|
| 64 | 64 | */ |
| 65 | 65 | public static function normalise($path) |
| 66 | 66 | { |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function basePath($basePath = null) |
| 56 | 56 | { |
| 57 | - $this->basePath = $basePath ?: realpath(__DIR__ . '/../../'); |
|
| 57 | + $this->basePath = $basePath ?: realpath(__DIR__.'/../../'); |
|
| 58 | 58 | |
| 59 | 59 | return $this->basePath; |
| 60 | 60 | } |
@@ -131,19 +131,19 @@ discard block |
||
| 131 | 131 | $nsBasePaths = array(''); |
| 132 | 132 | |
| 133 | 133 | if ($this->basePath) { |
| 134 | - $nsBasePaths[] = $this->basePath . '/'; |
|
| 134 | + $nsBasePaths[] = $this->basePath.'/'; |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | foreach ($nsBasePaths as $nsBasePath) { |
| 138 | 138 | if ($class === $ns) { |
| 139 | 139 | array_push($paths, "$nsBasePath$nsPath"); |
| 140 | 140 | array_push($paths, "$nsBasePath$nsPath/$className.php"); |
| 141 | - array_push($paths, "$nsBasePath" . strtolower($nsPath) . "/$className.php"); |
|
| 141 | + array_push($paths, "$nsBasePath".strtolower($nsPath)."/$className.php"); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | if (strpos($class, $ns) === 0) { |
| 145 | 145 | array_push($paths, "$nsBasePath$nsPath/$dir/$className.php"); |
| 146 | - array_push($paths, "$nsBasePath" . strtolower("$nsPath/$dir") . "/$className.php"); |
|
| 146 | + array_push($paths, "$nsBasePath".strtolower("$nsPath/$dir")."/$className.php"); |
|
| 147 | 147 | |
| 148 | 148 | $nsRemain = str_replace('\\', '/', substr($class, strlen($ns))); |
| 149 | 149 | array_push($paths, "$nsBasePath$nsPath/$nsRemain.php"); |
@@ -151,32 +151,32 @@ discard block |
||
| 151 | 151 | |
| 152 | 152 | $nsRemainDir = dirname($nsRemain); |
| 153 | 153 | $nsRemainFile = basename($nsRemain); |
| 154 | - array_push($paths, "$nsBasePath$nsPath/" . strtolower($nsRemainDir) . "/$nsRemainFile.php"); |
|
| 154 | + array_push($paths, "$nsBasePath$nsPath/".strtolower($nsRemainDir)."/$nsRemainFile.php"); |
|
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | // Try using the namespace as an exact directory mapping |
| 161 | - array_push($paths, $this->basePath . "/$dir/$className.php"); |
|
| 161 | + array_push($paths, $this->basePath."/$dir/$className.php"); |
|
| 162 | 162 | |
| 163 | 163 | // Try using the namespace in lowercase as a directory mapping, with |
| 164 | 164 | // only the class name in its original case |
| 165 | 165 | $dirLowercase = strtolower($dir); |
| 166 | - array_push($paths, $this->basePath . "/$dirLowercase/$className.php"); |
|
| 166 | + array_push($paths, $this->basePath."/$dirLowercase/$className.php"); |
|
| 167 | 167 | |
| 168 | 168 | // Last try using the last part of the namespace as a subdirectory, with |
| 169 | 169 | // and without a trailing 's', as well as any common subdirectory names |
| 170 | 170 | $subdirs = array_merge($this->commonSubdirs, array( |
| 171 | 171 | $className, |
| 172 | - $className . 's', |
|
| 172 | + $className.'s', |
|
| 173 | 173 | )); |
| 174 | 174 | |
| 175 | 175 | foreach ($subdirs as $subdir) { |
| 176 | - array_push($paths, $this->basePath . "/$dir/$subdir/$className.php"); |
|
| 176 | + array_push($paths, $this->basePath."/$dir/$subdir/$className.php"); |
|
| 177 | 177 | |
| 178 | 178 | $subdirLowercase = strtolower($subdir); |
| 179 | - array_push($paths, $this->basePath . "/$dirLowercase/$subdirLowercase/$className.php"); |
|
| 179 | + array_push($paths, $this->basePath."/$dirLowercase/$subdirLowercase/$className.php"); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | // Finally, attempt to find the class |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | * @return mixed |
| 21 | 21 | */ |
| 22 | 22 | public function transform($value, $type = '') { |
| 23 | - $method = 'transform' . ucfirst($type); |
|
| 23 | + $method = 'transform'.ucfirst($type); |
|
| 24 | 24 | |
| 25 | 25 | if (method_exists($this, $method)) { |
| 26 | 26 | return $this->$method($value); |
@@ -150,7 +150,7 @@ |
||
| 150 | 150 | $names = array($parent, $target); |
| 151 | 151 | sort($names); |
| 152 | 152 | |
| 153 | - $this->table = implode('_', $names) . 's'; |
|
| 153 | + $this->table = implode('_', $names).'s'; |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | /** |
@@ -199,8 +199,8 @@ discard block |
||
| 199 | 199 | $split = explode('\\', $class); |
| 200 | 200 | $class = end($split); |
| 201 | 201 | |
| 202 | - return preg_replace_callback('/([A-Z])/', function ($matches) { |
|
| 203 | - return '_' . strtolower($matches[1]); |
|
| 202 | + return preg_replace_callback('/([A-Z])/', function($matches) { |
|
| 203 | + return '_'.strtolower($matches[1]); |
|
| 204 | 204 | }, lcfirst($class)); |
| 205 | 205 | } |
| 206 | 206 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | * @return string |
| 212 | 212 | */ |
| 213 | 213 | protected function prepareForeignKey($class) { |
| 214 | - return $this->delimitClass($class) . '_id'; |
|
| 214 | + return $this->delimitClass($class).'_id'; |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | /** |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | |
| 374 | 374 | foreach (static::arrayify($instances) as $instance) { |
| 375 | 375 | if (!$instance instanceof $class) { |
| 376 | - throw new Exception('Related models must be an instance of ' . $class); |
|
| 376 | + throw new Exception('Related models must be an instance of '.$class); |
|
| 377 | 377 | } |
| 378 | 378 | } |
| 379 | 379 | } |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | $item = array($index++, $item); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - usort($data, function ($a, $b) use ($order) { |
|
| 78 | + usort($data, function($a, $b) use ($order) { |
|
| 79 | 79 | foreach ($order as $field => $direction) { |
| 80 | 80 | if (!isset($a[1][$field]) || !isset($b[1][$field])) { |
| 81 | 81 | continue; |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | */ |
| 77 | 77 | protected static function snakeToCamel($string) |
| 78 | 78 | { |
| 79 | - return preg_replace_callback('/_(.)/', function ($matches) { |
|
| 79 | + return preg_replace_callback('/_(.)/', function($matches) { |
|
| 80 | 80 | return strtoupper($matches[1]); |
| 81 | 81 | }, $string); |
| 82 | 82 | } |