Conditions | 3 |
Paths | 3 |
Total Lines | 53 |
Code Lines | 28 |
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 |
||
16 | public function run() |
||
17 | { |
||
18 | /* |
||
19 | * Blocked Types |
||
20 | * |
||
21 | */ |
||
22 | $BlockedItems = [ |
||
23 | [ |
||
24 | 'type' => 'domain', |
||
25 | 'value' => 'test.com', |
||
26 | 'note' => 'Block all domains/emails @test.com', |
||
27 | ], |
||
28 | [ |
||
29 | 'type' => 'domain', |
||
30 | 'value' => 'test.ca', |
||
31 | 'note' => 'Block all domains/emails @test.ca', |
||
32 | ], |
||
33 | [ |
||
34 | 'type' => 'domain', |
||
35 | 'value' => 'fake.com', |
||
36 | 'note' => 'Block all domains/emails @fake.com', |
||
37 | ], |
||
38 | [ |
||
39 | 'type' => 'domain', |
||
40 | 'value' => 'example.com', |
||
41 | 'note' => 'Block all domains/emails @example.com', |
||
42 | ], |
||
43 | [ |
||
44 | 'type' => 'domain', |
||
45 | 'value' => 'mailinator.com', |
||
46 | 'note' => 'Block all domains/emails @mailinator.com', |
||
47 | ], |
||
48 | ]; |
||
49 | |||
50 | /* |
||
51 | * Add Blocked Items |
||
52 | * |
||
53 | */ |
||
54 | foreach ($BlockedItems as $BlockedItem) { |
||
55 | $blockType = BlockedType::where('slug', $BlockedItem['type'])->first(); |
||
56 | $newBlockedItem = BlockedItem::where('typeId', '=', $blockType->id) |
||
57 | ->where('value', '=', $BlockedItem['value']) |
||
58 | ->withTrashed() |
||
59 | ->first(); |
||
60 | if ($newBlockedItem === null) { |
||
61 | $newBlockedItem = BlockedItem::create([ |
||
62 | 'typeId' => $blockType->id, |
||
63 | 'value' => $BlockedItem['value'], |
||
64 | 'note' => $BlockedItem['note'], |
||
65 | ]); |
||
66 | } |
||
67 | } |
||
68 | echo "\e[32mSeeding:\e[0m DefaultBlockedItemsTableSeeder\r\n"; |
||
69 | } |
||
71 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths