Conditions | 1 |
Paths | 1 |
Total Lines | 62 |
Code Lines | 49 |
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 |
||
78 | public static function getFieldDefinitions(): array |
||
79 | { |
||
80 | return array_merge(parent::getFieldDefinitions(), [ |
||
81 | 'id' => [ |
||
82 | 'name' => 'id', |
||
83 | 'type' => Type::int(), |
||
84 | 'description' => 'The id of the redirect.', |
||
85 | ], |
||
86 | 'siteId' => [ |
||
87 | 'name' => 'siteId', |
||
88 | 'type' => Type::int(), |
||
89 | 'description' => 'The siteId of the redirect (0 or null for all sites).', |
||
90 | ], |
||
91 | 'associatedElementId' => [ |
||
92 | 'name' => 'associatedElementId', |
||
93 | 'type' => Type::int(), |
||
94 | 'description' => 'The id of the Element associated with this redirect (unused/vestigial).', |
||
95 | ], |
||
96 | 'enabled' => [ |
||
97 | 'name' => 'enabled', |
||
98 | 'type' => Type::boolean(), |
||
99 | 'description' => 'Whether the redirect is enabled or not.', |
||
100 | ], |
||
101 | 'redirectSrcUrl' => [ |
||
102 | 'name' => 'redirectSrcUrl', |
||
103 | 'type' => Type::string(), |
||
104 | 'description' => 'The unparsed URL pattern that Retour should match.', |
||
105 | ], |
||
106 | 'redirectSrcUrlParsed' => [ |
||
107 | 'name' => 'redirectSrcUrlParsed', |
||
108 | 'type' => Type::string(), |
||
109 | 'description' => 'The parsed URL pattern that Retour should match.', |
||
110 | ], |
||
111 | 'redirectSrcMatch' => [ |
||
112 | 'name' => 'redirectSrcMatch', |
||
113 | 'type' => Type::string(), |
||
114 | 'description' => 'Should the legacy URL be matched by path or by full URL?', |
||
115 | ], |
||
116 | 'redirectMatchType' => [ |
||
117 | 'name' => 'redirectMatchType', |
||
118 | 'type' => Type::string(), |
||
119 | 'description' => 'Whether an `exactmatch` or `regexmatch` should be used when matching the URL.', |
||
120 | ], |
||
121 | 'redirectDestUrl' => [ |
||
122 | 'name' => 'redirectDestUrl', |
||
123 | 'type' => Type::string(), |
||
124 | 'description' => 'The URL that should be redirected to.', |
||
125 | ], |
||
126 | 'redirectHttpCode' => [ |
||
127 | 'name' => 'redirectHttpCode', |
||
128 | 'type' => Type::int(), |
||
129 | 'description' => 'The http status code that should be used for the redirect.', |
||
130 | ], |
||
131 | 'hitCount' => [ |
||
132 | 'name' => 'hitCount', |
||
133 | 'type' => Type::int(), |
||
134 | 'description' => 'The number of times this redirect has been hit.', |
||
135 | ], |
||
136 | 'hitLastTime' => [ |
||
137 | 'name' => 'hitLastTime', |
||
138 | 'type' => Type::string(), |
||
139 | 'description' => 'A datetime string of when this redirect was last hit.', |
||
140 | ], |
||
144 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.