Conditions | 2 |
Paths | 2 |
Total Lines | 68 |
Lines | 0 |
Ratio | 0 % |
Changes | 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 |
||
65 | public function handle(Filesystem $filesystem) |
||
66 | { |
||
67 | $this->info('Publishing the Voyager assets, database, and config files'); |
||
68 | |||
69 | // Publish only relevant resources on install |
||
70 | // $tags = ['seeds']; |
||
71 | |||
72 | $this->call('vendor:publish', ['--provider' => VoyagerServiceProvider::class, '--tag' => $tags]); |
||
|
|||
73 | |||
74 | // $this->info('Migrating the database tables into your application'); |
||
75 | // $this->call('migrate', ['--force' => $this->option('force')]); |
||
76 | |||
77 | // $this->info('Attempting to set Voyager User model as parent to App\User'); |
||
78 | // if (file_exists(app_path('User.php'))) { |
||
79 | // $str = file_get_contents(app_path('User.php')); |
||
80 | |||
81 | // if ($str !== false) { |
||
82 | // $str = str_replace('extends Authenticatable', "extends \TCG\Voyager\Models\User", $str); |
||
83 | |||
84 | // file_put_contents(app_path('User.php'), $str); |
||
85 | // } |
||
86 | // } else { |
||
87 | // $this->warn('Unable to locate "app/User.php". Did you move this file?'); |
||
88 | // $this->warn('You will need to update this manually. Change "extends Authenticatable" to "extends \TCG\Voyager\Models\User" in your User model'); |
||
89 | // } |
||
90 | |||
91 | $this->info('Dumping the autoloaded files and reloading all new files'); |
||
92 | |||
93 | $composer = $this->findComposer(); |
||
94 | |||
95 | $process = new Process([$composer.' dump-autoload']); |
||
96 | $process->setTimeout(null); // Setting timeout to null to prevent installation from stopping at a certain point in time |
||
97 | $process->setWorkingDirectory(base_path())->run(); |
||
98 | |||
99 | $this->info('Adding Environment Variables'); |
||
100 | $routes_contents = $filesystem->get(base_path('.env')); |
||
101 | if (false === strpos($routes_contents, "\n\nGOOD_TILL_DOAMIN=\nGOOD_TILL_USERNAME=\nGOOD_TILL_PASSWORD=")) { |
||
102 | $filesystem->append( |
||
103 | base_path('routes/web.php'), |
||
104 | "\n\nGOOD_TILL_DOAMIN=\nGOOD_TILL_USERNAME=\nGOOD_TILL_PASSWORD=" |
||
105 | ); |
||
106 | } |
||
107 | |||
108 | // $this->info('Seeding data into the database'); |
||
109 | // $this->seed('VoyagerDatabaseSeeder'); |
||
110 | |||
111 | // if ($this->option('with-dummy')) { |
||
112 | // $this->info('Publishing dummy content'); |
||
113 | // $tags = ['dummy_seeds', 'dummy_content', 'dummy_config', 'dummy_migrations']; |
||
114 | // $this->call('vendor:publish', ['--provider' => VoyagerDummyServiceProvider::class, '--tag' => $tags]); |
||
115 | |||
116 | // $this->info('Migrating dummy tables'); |
||
117 | // $this->call('migrate'); |
||
118 | |||
119 | // $this->info('Seeding dummy data'); |
||
120 | // $this->seed('VoyagerDummyDatabaseSeeder'); |
||
121 | // } else { |
||
122 | // $this->call('vendor:publish', ['--provider' => VoyagerServiceProvider::class, '--tag' => ['config', 'voyager_avatar']]); |
||
123 | // } |
||
124 | |||
125 | // $this->info('Setting up the hooks'); |
||
126 | // $this->call('hook:setup'); |
||
127 | |||
128 | // $this->info('Adding the storage symlink to your public folder'); |
||
129 | // $this->call('storage:link'); |
||
130 | |||
131 | // $this->info('Successfully installed Voyager! Enjoy'); |
||
132 | } |
||
133 | } |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.