Conditions | 10 |
Paths | 512 |
Total Lines | 60 |
Code Lines | 39 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | 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 |
||
39 | public function handle() |
||
40 | { |
||
41 | $this->line('=== Check Laravel .env ==='); |
||
42 | |||
43 | if( !env('LARROCK VARS')){ |
||
44 | $this->info('=== Add LARROCK vars ==='); |
||
45 | $current_env = \File::get(base_path('.env')); |
||
46 | \File::put(base_path('.env'), $current_env ."\n\nLARROCK VARS=PLACED"); |
||
47 | } |
||
48 | |||
49 | if( !env('MAIL_TEMPLATE_ADDRESS')){ |
||
50 | $current_env = \File::get(base_path('.env')); |
||
51 | \File::put(base_path('.env'), $current_env ."\nMAIL_TEMPLATE_ADDRESS='company address'"); |
||
52 | $this->info('MAIL_FROM_ADDRESS not found. Add "company address"'); |
||
53 | } |
||
54 | |||
55 | if( !env('MAIL_TEMPLATE_PHONE')){ |
||
56 | $current_env = \File::get(base_path('.env')); |
||
57 | \File::put(base_path('.env'), $current_env ."\nMAIL_TEMPLATE_PHONE=company phone"); |
||
58 | $this->info('MAIL_TEMPLATE_PHONE not found. Add "company phone"'); |
||
59 | } |
||
60 | |||
61 | if( !env('MAIL_TEMPLATE_MAIL')){ |
||
62 | $current_env = \File::get(base_path('.env')); |
||
63 | \File::put(base_path('.env'), $current_env ."\[email protected]"); |
||
64 | $this->info('MAIL_TEMPLATE_MAIL not found. Add "[email protected]"'); |
||
65 | } |
||
66 | |||
67 | if( !env('MAIL_FROM_ADDRESS')){ |
||
68 | $current_env = \File::get(base_path('.env')); |
||
69 | \File::put(base_path('.env'), $current_env ."\[email protected]"); |
||
70 | $this->info('MAIL_FROM_ADDRESS not found. Add "[email protected]"'); |
||
71 | } |
||
72 | |||
73 | if( !env('MAIL_TO_ADMIN')){ |
||
74 | $current_env = \File::get(base_path('.env')); |
||
75 | \File::put(base_path('.env'), $current_env ."\[email protected]"); |
||
76 | $this->info('MAIL_TO_ADMIN not found. Add "[email protected]"'); |
||
77 | } |
||
78 | |||
79 | if( !env('MAIL_FROM_NAME')){ |
||
80 | $current_env = \File::get(base_path('.env')); |
||
81 | \File::put(base_path('.env'), $current_env ."\nMAIL_FROM_NAME='LARROCK'"); |
||
82 | $this->info('MAIL_FROM_NAME not found. Add "LARROCK"'); |
||
83 | } |
||
84 | |||
85 | if( !env('SITE_NAME')){ |
||
86 | $current_env = \File::get(base_path('.env')); |
||
87 | \File::put(base_path('.env'), $current_env ."\nSITE_NAME='LARROCK'"); |
||
88 | $this->info('SITE_NAME not found. Add "LARROCK"'); |
||
89 | } |
||
90 | |||
91 | if( !env('MAIL_STOP')){ |
||
92 | $current_env = \File::get(base_path('.env')); |
||
93 | \File::put(base_path('.env'), $current_env ."\nMAIL_STOP=false"); |
||
94 | $this->info('MAIL_STOP not found. Add "false"'); |
||
95 | } |
||
96 | |||
97 | $this->info('.env vars currently installed'); |
||
98 | } |
||
99 | } |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.