Conditions | 5 |
Paths | 1 |
Total Lines | 40 |
Code Lines | 23 |
Lines | 27 |
Ratio | 67.5 % |
Tests | 20 |
CRAP Score | 5.4358 |
Changes | 0 |
1 | <?php |
||
36 | 2 | public function install(): void |
|
37 | { |
||
38 | 2 | $this->require('vlucas/phpdotenv'); |
|
39 | |||
40 | 2 | $this->task( |
|
|
|||
41 | 2 | 'Creating .env', |
|
42 | 2 | View Code Duplication | function () { |
43 | 2 | if (! File::exists(base_path('.env'))) { |
|
44 | 2 | return File::put(base_path('.env'), 'CONSUMER_KEY='); |
|
45 | } |
||
46 | |||
47 | return false; |
||
48 | 2 | } |
|
49 | ); |
||
50 | |||
51 | 2 | $this->task( |
|
52 | 2 | 'Creating .env.example', |
|
53 | 2 | View Code Duplication | function () { |
54 | 2 | if (! File::exists(base_path('.env.example'))) { |
|
55 | 2 | return File::put(base_path('.env.example'), 'CONSUMER_KEY='); |
|
56 | } |
||
57 | |||
58 | return false; |
||
59 | 2 | } |
|
60 | ); |
||
61 | |||
62 | 2 | View Code Duplication | $this->task('Updating .gitignore', function () { |
63 | 2 | $gitignorePath = base_path('.gitignore'); |
|
64 | 2 | if (File::exists($gitignorePath)) { |
|
65 | $contents = File::get($gitignorePath); |
||
66 | $neededLine = '.env'; |
||
67 | if (! Str::contains($contents, $neededLine)) { |
||
68 | File::append($gitignorePath, $neededLine . PHP_EOL); |
||
69 | return true; |
||
70 | } |
||
71 | } |
||
72 | |||
73 | 2 | return false; |
|
74 | 2 | }); |
|
75 | 2 | } |
|
76 | } |
||
77 |
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: