| Conditions | 10 |
| Paths | 512 |
| Total Lines | 50 |
| Code Lines | 29 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 1 |
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 |
||
| 29 | public function handle() |
||
| 30 | { |
||
| 31 | $this->line('=== Check Laravel .env ==='); |
||
| 32 | |||
| 33 | if (! env('LARROCK VARS')) { |
||
| 34 | $this->info('=== Add LARROCK vars ==='); |
||
| 35 | \File::append(base_path('.env'), "\n\nLARROCK VARS=PLACED"); |
||
| 36 | } |
||
| 37 | |||
| 38 | if (! env('MAIL_TEMPLATE_ADDRESS')) { |
||
| 39 | \File::append(base_path('.env'), "\nMAIL_TEMPLATE_ADDRESS='company address'"); |
||
| 40 | $this->info('MAIL_FROM_ADDRESS not found. Add "company address"'); |
||
| 41 | } |
||
| 42 | |||
| 43 | if (! env('MAIL_TEMPLATE_PHONE')) { |
||
| 44 | \File::append(base_path('.env'), "\nMAIL_TEMPLATE_PHONE='company phone'"); |
||
| 45 | $this->info('MAIL_TEMPLATE_PHONE not found. Add "company phone"'); |
||
| 46 | } |
||
| 47 | |||
| 48 | if (! env('MAIL_TEMPLATE_MAIL')) { |
||
| 49 | \File::append(base_path('.env'), "\[email protected]"); |
||
| 50 | $this->info('MAIL_TEMPLATE_MAIL not found. Add "[email protected]"'); |
||
| 51 | } |
||
| 52 | |||
| 53 | if (! env('MAIL_FROM_ADDRESS')) { |
||
| 54 | \File::append(base_path('.env'), "\[email protected]"); |
||
| 55 | $this->info('MAIL_FROM_ADDRESS not found. Add "[email protected]"'); |
||
| 56 | } |
||
| 57 | |||
| 58 | if (! env('MAIL_TO_ADMIN')) { |
||
| 59 | \File::append(base_path('.env'), "\[email protected]"); |
||
| 60 | $this->info('MAIL_TO_ADMIN not found. Add "[email protected]"'); |
||
| 61 | } |
||
| 62 | |||
| 63 | if (! env('MAIL_FROM_NAME')) { |
||
| 64 | \File::append(base_path('.env'), "\nMAIL_FROM_NAME='LARROCK'"); |
||
| 65 | $this->info('MAIL_FROM_NAME not found. Add "LARROCK"'); |
||
| 66 | } |
||
| 67 | |||
| 68 | if (! env('SITE_NAME')) { |
||
| 69 | \File::append(base_path('.env'), "\nSITE_NAME='LARROCK'"); |
||
| 70 | $this->info('SITE_NAME not found. Add "LARROCK"'); |
||
| 71 | } |
||
| 72 | |||
| 73 | if (env('MAIL_STOP', false) !== false) { |
||
| 74 | \File::append(base_path('.env'), "\nMAIL_STOP=false"); |
||
| 75 | $this->info('MAIL_STOP not found. Add "false"'); |
||
| 76 | } |
||
| 77 | |||
| 78 | $this->info('.env vars currently installed'); |
||
| 79 | } |
||
| 81 |