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