Conditions | 1 |
Paths | 1 |
Total Lines | 56 |
Code Lines | 39 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 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 |
||
56 | public function setUp() |
||
57 | { |
||
58 | Config::modify()->set( |
||
59 | Mapper::class . '.' . $this->importerKey, |
||
60 | 'mapping', |
||
61 | [ |
||
62 | MappedObject::class => [ |
||
63 | 'SalsifyID' => [ |
||
64 | 'salsifyField' => 'salsify:id', |
||
65 | ], |
||
66 | 'SalsifyUpdatedAt' => 'salsify:updated_at', |
||
67 | 'Unique' => [ |
||
68 | 'salsifyField' => 'custom-field-unique', |
||
69 | 'unique' => true, |
||
70 | 'shouldSkip' => 'testSkip', |
||
71 | ], |
||
72 | 'Title' => 'custom-field-title', |
||
73 | 'Seller' => [ |
||
74 | 'salsifyField' => 'custom-field-seller', |
||
75 | 'unique' => false, |
||
76 | ], |
||
77 | 'Modified' => [ |
||
78 | 'salsifyField' => 'custom-field-modified', |
||
79 | 'modification' => 'testModification' |
||
80 | ], |
||
81 | 'MainImage' => [ |
||
82 | 'salsifyField' => 'custom-field-front-image', |
||
83 | 'type' => 'Image', |
||
84 | ], |
||
85 | 'Images' => [ |
||
86 | 'salsifyField' => 'custom-field-images', |
||
87 | 'type' => 'ManyImages', |
||
88 | 'sortColumn' => 'SortOrder', |
||
89 | ], |
||
90 | 'FallbackString' => [ |
||
91 | 'salsifyField' => 'YYYYY', |
||
92 | 'fallback' => 'custom-field-title', |
||
93 | ], |
||
94 | 'FallbackArray' => [ |
||
95 | 'salsifyField' => 'YYYYY', |
||
96 | 'fallback' => [ |
||
97 | 'XXXXX', |
||
98 | 'custom-field-seller', |
||
99 | ], |
||
100 | ], |
||
101 | 'Unknown' => [ |
||
102 | 'unique' => true, |
||
103 | ], |
||
104 | 'Unknown2' => [ |
||
105 | 'salsifyField' => 'XXXXX', |
||
106 | ], |
||
107 | ], |
||
108 | ] |
||
109 | ); |
||
110 | Config::modify()->set(ImportTask::class, 'output', false); |
||
111 | return parent::setUp(); |
||
112 | } |
||
191 |