@@ -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 | } |
@@ -84,8 +84,8 @@ discard block |
||
| 84 | 84 | * @param string|array $extensions |
| 85 | 85 | */ |
| 86 | 86 | public static function registerExtensions($extensions) { |
| 87 | - $extensions = array_map(function ($extension) { |
|
| 88 | - return '.' . ltrim(trim($extension), '.'); |
|
| 87 | + $extensions = array_map(function($extension) { |
|
| 88 | + return '.'.ltrim(trim($extension), '.'); |
|
| 89 | 89 | }, (array) $extensions); |
| 90 | 90 | |
| 91 | 91 | static::$extensions = array_merge(static::$extensions, $extensions); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | |
| 195 | 195 | foreach ($extensions as $extension) { |
| 196 | 196 | if (static::$basePath) { |
| 197 | - $paths[] = static::$basePath . "/$path$extension"; |
|
| 197 | + $paths[] = static::$basePath."/$path$extension"; |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | $paths[] = "$path$extension"; |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | { |
| 55 | 55 | $this->touch($event); |
| 56 | 56 | |
| 57 | - $this->listeners[$event] = array_filter($this->listeners[$event], function ($value) use ($callable) { |
|
| 57 | + $this->listeners[$event] = array_filter($this->listeners[$event], function($value) use ($callable) { |
|
| 58 | 58 | return $value !== $callable; |
| 59 | 59 | }); |
| 60 | 60 | } |