@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function getPath() |
| 90 | 90 | { |
| 91 | - return static::getBasePath() . $this->path; |
|
| 91 | + return static::getBasePath().$this->path; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | $contents = file_get_contents($this->getPath()); |
| 122 | 122 | |
| 123 | 123 | foreach ($this->replaces as $search => $replace) { |
| 124 | - $contents = str_replace('$' . strtoupper($search) . '$', $replace, $contents); |
|
| 124 | + $contents = str_replace('$'.strtoupper($search).'$', $replace, $contents); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | return $contents; |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | public function saveTo($path, $filename) |
| 149 | 149 | { |
| 150 | - return file_put_contents($path . '/' . $filename, $this->getContents()); |
|
| 150 | + return file_put_contents($path.'/'.$filename, $this->getContents()); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /** |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | |
| 66 | 66 | $jobPath = $this->laravel['modules']->config('paths.generator.jobs'); |
| 67 | 67 | |
| 68 | - return $path . $jobPath . '/' . $this->getFileName() . '.php'; |
|
| 68 | + return $path.$jobPath.'/'.$this->getFileName().'.php'; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public function createField($column, $attributes, $type = 'add') |
| 145 | 145 | { |
| 146 | - $results = "\t\t\t" . '$table'; |
|
| 146 | + $results = "\t\t\t".'$table'; |
|
| 147 | 147 | |
| 148 | 148 | foreach ($attributes as $key => $field) { |
| 149 | 149 | if (in_array($column, $this->relationshipKeys)) { |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - return $results .= ';' . PHP_EOL; |
|
| 156 | + return $results .= ';'.PHP_EOL; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | protected function addRelationColumn($key, $field, $column) |
| 169 | 169 | { |
| 170 | - $relatedColumn = snake_case(class_basename($field)) . '_id'; |
|
| 170 | + $relatedColumn = snake_case(class_basename($field)).'_id'; |
|
| 171 | 171 | |
| 172 | 172 | $method = 'integer'; |
| 173 | 173 | |
@@ -186,18 +186,18 @@ discard block |
||
| 186 | 186 | protected function addColumn($key, $field, $column) |
| 187 | 187 | { |
| 188 | 188 | if ($this->hasCustomAttribute($column)) { |
| 189 | - return '->' . $field; |
|
| 189 | + return '->'.$field; |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | if ($key == 0) { |
| 193 | - return '->' . $field . "('" . $column . "')"; |
|
| 193 | + return '->'.$field."('".$column."')"; |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | if (str_contains($field, '(')) { |
| 197 | - return '->' . $field; |
|
| 197 | + return '->'.$field; |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - return '->' . $field . '()'; |
|
| 200 | + return '->'.$field.'()'; |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | /** |
@@ -212,10 +212,10 @@ discard block |
||
| 212 | 212 | protected function removeColumn($key, $field, $column) |
| 213 | 213 | { |
| 214 | 214 | if ($this->hasCustomAttribute($column)) { |
| 215 | - return '->' . $field; |
|
| 215 | + return '->'.$field; |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - return '->dropColumn(' . "'" . $column . "')"; |
|
| 218 | + return '->dropColumn('."'".$column."')"; |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | /** |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | */ |
| 241 | 241 | public function getAttributes($column, $schema) |
| 242 | 242 | { |
| 243 | - $fields = str_replace($column . ':', '', $schema); |
|
| 243 | + $fields = str_replace($column.':', '', $schema); |
|
| 244 | 244 | |
| 245 | 245 | return $this->hasCustomAttribute($column) ? $this->getCustomAttribute($column) : explode(':', $fields); |
| 246 | 246 | } |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | - * @param $name |
|
| 68 | + * @param string $name |
|
| 69 | 69 | * |
| 70 | 70 | * @throws RuntimeException |
| 71 | 71 | * |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $name = $module->getName(); |
| 95 | 95 | $config = $module->get('migration'); |
| 96 | 96 | if (is_array($config) && array_key_exists('seeds', $config)) { |
| 97 | - foreach ((array)$config['seeds'] as $class) { |
|
| 97 | + foreach ((array) $config['seeds'] as $class) { |
|
| 98 | 98 | if (@class_exists($class)) { |
| 99 | 99 | $seeders[] = $class; |
| 100 | 100 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | $namespace = $this->laravel['modules']->config('namespace'); |
| 151 | 151 | |
| 152 | - return $namespace . '\\' . $name . '\Database\Seeders\\' . $name . 'DatabaseSeeder'; |
|
| 152 | + return $namespace.'\\'.$name.'\Database\Seeders\\'.$name.'DatabaseSeeder'; |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | { |
| 96 | 96 | $paths = $this->paths; |
| 97 | 97 | |
| 98 | - $paths[] = $this->getPath() . '/*'; |
|
| 98 | + $paths[] = $this->getPath().'/*'; |
|
| 99 | 99 | |
| 100 | 100 | if ($this->config('scan.enabled')) { |
| 101 | 101 | $paths = array_merge($paths, $this->config('scan.paths')); |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | $modules = []; |
| 157 | 157 | |
| 158 | 158 | foreach ($cached as $name => $module) { |
| 159 | - $path = $this->config('paths.modules') . '/' . $name; |
|
| 159 | + $path = $this->config('paths.modules').'/'.$name; |
|
| 160 | 160 | |
| 161 | 161 | $modules[$name] = new Module($this->app, $name, $path); |
| 162 | 162 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | public function getCached() |
| 173 | 173 | { |
| 174 | - return $this->app['cache']->remember($this->config('cache.key'), $this->config('cache.lifetime'), function () { |
|
| 174 | + return $this->app['cache']->remember($this->config('cache.key'), $this->config('cache.lifetime'), function() { |
|
| 175 | 175 | return $this->toCollection()->toArray(); |
| 176 | 176 | }); |
| 177 | 177 | } |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | { |
| 260 | 260 | $modules = $this->enabled(); |
| 261 | 261 | |
| 262 | - uasort($modules, function (Module $a, Module $b) use ($direction) { |
|
| 262 | + uasort($modules, function(Module $a, Module $b) use ($direction) { |
|
| 263 | 263 | if ($a->order == $b->order) { |
| 264 | 264 | return 0; |
| 265 | 265 | } |
@@ -370,9 +370,9 @@ discard block |
||
| 370 | 370 | public function getModulePath($module) |
| 371 | 371 | { |
| 372 | 372 | try { |
| 373 | - return $this->findOrFail($module)->getPath() . '/'; |
|
| 373 | + return $this->findOrFail($module)->getPath().'/'; |
|
| 374 | 374 | } catch (ModuleNotFoundException $e) { |
| 375 | - return $this->getPath() . '/' . Str::studly($module) . '/'; |
|
| 375 | + return $this->getPath().'/'.Str::studly($module).'/'; |
|
| 376 | 376 | } |
| 377 | 377 | } |
| 378 | 378 | |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | */ |
| 386 | 386 | public function assetPath($module) |
| 387 | 387 | { |
| 388 | - return $this->config('paths.assets') . '/' . $module; |
|
| 388 | + return $this->config('paths.assets').'/'.$module; |
|
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | /** |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | */ |
| 399 | 399 | public function config($key, $default = null) |
| 400 | 400 | { |
| 401 | - return $this->app['config']->get('modules.' . $key, $default); |
|
| 401 | + return $this->app['config']->get('modules.'.$key, $default); |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | /** |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | $this->app['files']->makeDirectory($path, 0777, true); |
| 413 | 413 | } |
| 414 | 414 | |
| 415 | - return $path . '/modules.used'; |
|
| 415 | + return $path.'/modules.used'; |
|
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | /** |
@@ -480,9 +480,9 @@ discard block |
||
| 480 | 480 | { |
| 481 | 481 | list($name, $url) = explode(':', $asset); |
| 482 | 482 | |
| 483 | - $baseUrl = str_replace(public_path() . DIRECTORY_SEPARATOR, '', $this->getAssetsPath()); |
|
| 483 | + $baseUrl = str_replace(public_path().DIRECTORY_SEPARATOR, '', $this->getAssetsPath()); |
|
| 484 | 484 | |
| 485 | - $url = $this->app['url']->asset($baseUrl . "/{$name}/" . $url); |
|
| 485 | + $url = $this->app['url']->asset($baseUrl."/{$name}/".$url); |
|
| 486 | 486 | |
| 487 | 487 | return str_replace(['http://', 'https://'], '//', $url); |
| 488 | 488 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | /** |
| 93 | 93 | * Get scanned modules paths. |
| 94 | 94 | * |
| 95 | - * @return array |
|
| 95 | + * @return string[] |
|
| 96 | 96 | */ |
| 97 | 97 | public function getScanPaths() |
| 98 | 98 | { |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | /** |
| 403 | 403 | * Get module path for a specific module. |
| 404 | 404 | * |
| 405 | - * @param $module |
|
| 405 | + * @param string $module |
|
| 406 | 406 | * |
| 407 | 407 | * @return string |
| 408 | 408 | */ |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | /** |
| 431 | 431 | * Get a specific config data from a configuration file. |
| 432 | 432 | * |
| 433 | - * @param $key |
|
| 433 | + * @param string $key |
|
| 434 | 434 | * |
| 435 | 435 | * @param null $default |
| 436 | 436 | * @return mixed |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | /** |
| 472 | 472 | * Get module used for cli session. |
| 473 | 473 | * |
| 474 | - * @return string |
|
| 474 | + * @return Module |
|
| 475 | 475 | */ |
| 476 | 476 | public function getUsedNow() |
| 477 | 477 | { |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | /** |
| 482 | 482 | * Get used now. |
| 483 | 483 | * |
| 484 | - * @return string |
|
| 484 | + * @return Module |
|
| 485 | 485 | */ |
| 486 | 486 | public function getUsed() |
| 487 | 487 | { |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | * |
| 556 | 556 | * @param string $name |
| 557 | 557 | * |
| 558 | - * @return bool |
|
| 558 | + * @return boolean|null |
|
| 559 | 559 | */ |
| 560 | 560 | public function enable($name) |
| 561 | 561 | { |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | * |
| 568 | 568 | * @param string $name |
| 569 | 569 | * |
| 570 | - * @return bool |
|
| 570 | + * @return boolean|null |
|
| 571 | 571 | */ |
| 572 | 572 | public function disable($name) |
| 573 | 573 | { |
@@ -90,7 +90,7 @@ |
||
| 90 | 90 | /** |
| 91 | 91 | * Get matches data from regex. |
| 92 | 92 | * |
| 93 | - * @return array |
|
| 93 | + * @return string[] |
|
| 94 | 94 | */ |
| 95 | 95 | public function getMatches() |
| 96 | 96 | { |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function getMigrations($reverse = false) |
| 85 | 85 | { |
| 86 | - $files = $this->laravel['files']->glob($this->getPath() . '/*_*.php'); |
|
| 86 | + $files = $this->laravel['files']->glob($this->getPath().'/*_*.php'); |
|
| 87 | 87 | |
| 88 | 88 | // Once we have the array of files in the directory we will just remove the |
| 89 | 89 | // extension and take the basename of the file which is all we need when |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | return array(); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - $files = array_map(function ($file) { |
|
| 95 | + $files = array_map(function($file) { |
|
| 96 | 96 | return str_replace('.php', '', basename($file)); |
| 97 | 97 | |
| 98 | 98 | }, $files); |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | { |
| 211 | 211 | $path = $this->getPath(); |
| 212 | 212 | foreach ($files as $file) { |
| 213 | - $this->laravel['files']->requireOnce($path . '/' . $file . '.php'); |
|
| 213 | + $this->laravel['files']->requireOnce($path.'/'.$file.'.php'); |
|
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | |
| 290 | 290 | $result = $query->orderBy('migration', 'desc')->get(); |
| 291 | 291 | |
| 292 | - return collect($result)->map(function ($item) { |
|
| 292 | + return collect($result)->map(function($item) { |
|
| 293 | 293 | return (array) $item; |
| 294 | 294 | })->pluck('migration'); |
| 295 | 295 | } |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | foreach ($this->module->getOrdered($this->option('direction')) as $module) { |
| 52 | - $this->line('Running for module: <info>' . $module->getName() . '</info>'); |
|
| 52 | + $this->line('Running for module: <info>'.$module->getName().'</info>'); |
|
| 53 | 53 | |
| 54 | 54 | $this->rollback($module); |
| 55 | 55 | } |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | foreach ($this->module->getOrdered($this->option('direction')) as $module) { |
| 52 | - $this->line('Running for module: <info>' . $module->getName() . '</info>'); |
|
| 52 | + $this->line('Running for module: <info>'.$module->getName().'</info>'); |
|
| 53 | 53 | |
| 54 | 54 | $this->reset($module); |
| 55 | 55 | } |