Conditions | 5 |
Paths | 1 |
Total Lines | 65 |
Code Lines | 50 |
Lines | 0 |
Ratio | 0 % |
Changes | 5 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
18 | public function boot() |
||
19 | { |
||
20 | $this->publishes([ |
||
21 | __DIR__ . '/Config/transarticles.php' => config_path('sirgrimorum/transarticles.php'), |
||
22 | ], 'config'); |
||
23 | $this->loadMigrationsFrom(__DIR__ . '/Migrations'); |
||
24 | |||
25 | Blade::directive('transarticles', function($nickname) { |
||
26 | $translations = new \Sirgrimorum\TransArticles\GetArticleFromDataBase($this->app); |
||
27 | return $translations->get(str_replace(['(', ')', ' ', '"', "'"], '', $nickname)); |
||
28 | }); |
||
29 | Blade::directive('transarticles_tojs', function($expression) { |
||
30 | $auxExpression = explode(',', str_replace(['(', ')', ' ', '"', "'"], '', $expression)); |
||
31 | if (count($auxExpression) > 1) |
||
32 | { |
||
33 | $scope = $auxExpression[0]; |
||
34 | $basevar = $auxExpression[1]; |
||
35 | } |
||
36 | else |
||
37 | { |
||
38 | $scope = $auxExpression[0]; |
||
39 | $basevar = ""; |
||
40 | } |
||
41 | $translations = new \Sirgrimorum\TransArticles\GetArticleFromDataBase($this->app); |
||
42 | return $translations->getjs($scope, $basevar); |
||
43 | }); |
||
44 | |||
45 | Artisan::command('transarticles:createseed {--all : Create a seed for all database tables except migrations table} {--force : Force the iseed}', function () { |
||
46 | $options = $this->options('all'); |
||
|
|||
47 | if ($options['all']) { |
||
48 | $dbName = env('DB_DATABASE'); |
||
49 | |||
50 | $query = \DB::select("SHOW TABLES WHERE Tables_in_$dbName <> 'migrations'"); |
||
51 | $collection = new \Illuminate\Support\Collection($query); |
||
52 | $tables = $collection->implode("Tables_in_$dbName",','); |
||
53 | $options = $this->options('force'); |
||
54 | if ($options['force']) { |
||
55 | $nombre = ""; |
||
56 | }else{ |
||
57 | $nombre = date("YmdHis"); |
||
58 | } |
||
59 | $this->info('Calling iseed for all tables except migrations with suffix "{$nombre}" ...'); |
||
60 | $this->call('iseed', [ |
||
61 | 'tables' => $tables, |
||
62 | '--classnamesuffix' => $nombre, |
||
63 | '--chunksize' => "100", |
||
64 | '--force' => $options['force'], |
||
65 | ]); |
||
66 | }else{ |
||
67 | $bar = $this->output->createProgressBar(2); |
||
68 | $confirm = $this->choice("Do you wisth to clean the DatabaseSeeder.php list?", ['yes', 'no'], 0); |
||
69 | $bar->advance(); |
||
70 | $nombre = date("YmdHis"); |
||
71 | if ($confirm == 'yes') { |
||
72 | $this->line("Creating seed archive of articles table and celaning DatabaseSeeder"); |
||
73 | Artisan::call("iseed articles --classnamesuffix={$nombre} --chunksize=100 --clean"); |
||
74 | } else { |
||
75 | $this->line("Creating seed archive of articles table and adding to DatabaseSeeder list"); |
||
76 | Artisan::call("iseed articles --classnamesuffix={$nombre} --chunksize=100"); |
||
77 | } |
||
78 | $this->info("Seed file created with the name Articles{$nombre}Seeder.php"); |
||
79 | $bar->advance(); |
||
80 | $bar->finish(); |
||
81 | } |
||
82 | })->describe('Create a seeder file with the current table Articles'); |
||
83 | } |
||
107 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.