| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 251 | 
| Code Lines | 180 | 
| 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  | 
            ||
| 26 | public function dataOptions(): array  | 
            ||
| 27 |     { | 
            ||
| 28 | return [  | 
            ||
| 29 | [  | 
            ||
| 30 | new Equal(1),  | 
            ||
| 31 | [  | 
            ||
| 32 | 'targetValue' => 1,  | 
            ||
| 33 | 'targetAttribute' => null,  | 
            ||
| 34 | 'incorrectInputMessage' => [  | 
            ||
| 35 | 'template' => 'The allowed types are integer, float, string, boolean and null.',  | 
            ||
| 36 | 'parameters' => [  | 
            ||
| 37 | 'targetValue' => 1,  | 
            ||
| 38 | 'targetAttribute' => null,  | 
            ||
| 39 | 'targetValueOrAttribute' => 1,  | 
            ||
| 40 | ],  | 
            ||
| 41 | ],  | 
            ||
| 42 | 'incorrectDataSetTypeMessage' => [  | 
            ||
| 43 | 'template' => 'The attribute value returned from a custom data set must have a scalar type.',  | 
            ||
| 44 | 'parameters' => [  | 
            ||
| 45 | 'targetValue' => 1,  | 
            ||
| 46 | 'targetAttribute' => null,  | 
            ||
| 47 | 'targetValueOrAttribute' => 1,  | 
            ||
| 48 | ],  | 
            ||
| 49 | ],  | 
            ||
| 50 | 'message' => [  | 
            ||
| 51 |                         'template' => 'Value must be equal to "{targetValueOrAttribute}".', | 
            ||
| 52 | 'parameters' => [  | 
            ||
| 53 | 'targetValue' => 1,  | 
            ||
| 54 | 'targetAttribute' => null,  | 
            ||
| 55 | 'targetValueOrAttribute' => 1,  | 
            ||
| 56 | ],  | 
            ||
| 57 | ],  | 
            ||
| 58 | 'type' => 'string',  | 
            ||
| 59 | 'operator' => '==',  | 
            ||
| 60 | 'skipOnEmpty' => false,  | 
            ||
| 61 | 'skipOnError' => false,  | 
            ||
| 62 | ],  | 
            ||
| 63 | ],  | 
            ||
| 64 | [  | 
            ||
| 65 | new Equal(1, type: CompareType::NUMBER),  | 
            ||
| 66 | [  | 
            ||
| 67 | 'targetValue' => 1,  | 
            ||
| 68 | 'targetAttribute' => null,  | 
            ||
| 69 | 'incorrectInputMessage' => [  | 
            ||
| 70 | 'template' => 'The allowed types are integer, float, string, boolean and null.',  | 
            ||
| 71 | 'parameters' => [  | 
            ||
| 72 | 'targetValue' => 1,  | 
            ||
| 73 | 'targetAttribute' => null,  | 
            ||
| 74 | 'targetValueOrAttribute' => 1,  | 
            ||
| 75 | ],  | 
            ||
| 76 | ],  | 
            ||
| 77 | 'incorrectDataSetTypeMessage' => [  | 
            ||
| 78 | 'template' => 'The attribute value returned from a custom data set must have a scalar type.',  | 
            ||
| 79 | 'parameters' => [  | 
            ||
| 80 | 'targetValue' => 1,  | 
            ||
| 81 | 'targetAttribute' => null,  | 
            ||
| 82 | 'targetValueOrAttribute' => 1,  | 
            ||
| 83 | ],  | 
            ||
| 84 | ],  | 
            ||
| 85 | 'message' => [  | 
            ||
| 86 |                         'template' => 'Value must be equal to "{targetValueOrAttribute}".', | 
            ||
| 87 | 'parameters' => [  | 
            ||
| 88 | 'targetValue' => 1,  | 
            ||
| 89 | 'targetAttribute' => null,  | 
            ||
| 90 | 'targetValueOrAttribute' => 1,  | 
            ||
| 91 | ],  | 
            ||
| 92 | ],  | 
            ||
| 93 | 'type' => 'number',  | 
            ||
| 94 | 'operator' => '==',  | 
            ||
| 95 | 'skipOnEmpty' => false,  | 
            ||
| 96 | 'skipOnError' => false,  | 
            ||
| 97 | ],  | 
            ||
| 98 | ],  | 
            ||
| 99 | [  | 
            ||
| 100 |                 new Equal('YES'), | 
            ||
| 101 | [  | 
            ||
| 102 | 'targetValue' => 'YES',  | 
            ||
| 103 | 'targetAttribute' => null,  | 
            ||
| 104 | 'incorrectInputMessage' => [  | 
            ||
| 105 | 'template' => 'The allowed types are integer, float, string, boolean and null.',  | 
            ||
| 106 | 'parameters' => [  | 
            ||
| 107 | 'targetValue' => 'YES',  | 
            ||
| 108 | 'targetAttribute' => null,  | 
            ||
| 109 | 'targetValueOrAttribute' => 'YES',  | 
            ||
| 110 | ],  | 
            ||
| 111 | ],  | 
            ||
| 112 | 'incorrectDataSetTypeMessage' => [  | 
            ||
| 113 | 'template' => 'The attribute value returned from a custom data set must have a scalar type.',  | 
            ||
| 114 | 'parameters' => [  | 
            ||
| 115 | 'targetValue' => 'YES',  | 
            ||
| 116 | 'targetAttribute' => null,  | 
            ||
| 117 | 'targetValueOrAttribute' => 'YES',  | 
            ||
| 118 | ],  | 
            ||
| 119 | ],  | 
            ||
| 120 | 'message' => [  | 
            ||
| 121 |                         'template' => 'Value must be equal to "{targetValueOrAttribute}".', | 
            ||
| 122 | 'parameters' => [  | 
            ||
| 123 | 'targetValue' => 'YES',  | 
            ||
| 124 | 'targetAttribute' => null,  | 
            ||
| 125 | 'targetValueOrAttribute' => 'YES',  | 
            ||
| 126 | ],  | 
            ||
| 127 | ],  | 
            ||
| 128 | 'type' => 'string',  | 
            ||
| 129 | 'operator' => '==',  | 
            ||
| 130 | 'skipOnEmpty' => false,  | 
            ||
| 131 | 'skipOnError' => false,  | 
            ||
| 132 | ],  | 
            ||
| 133 | ],  | 
            ||
| 134 | [  | 
            ||
| 135 |                 new Equal('YES', strict: true), | 
            ||
| 136 | [  | 
            ||
| 137 | 'targetValue' => 'YES',  | 
            ||
| 138 | 'targetAttribute' => null,  | 
            ||
| 139 | 'incorrectInputMessage' => [  | 
            ||
| 140 | 'template' => 'The allowed types are integer, float, string, boolean and null.',  | 
            ||
| 141 | 'parameters' => [  | 
            ||
| 142 | 'targetValue' => 'YES',  | 
            ||
| 143 | 'targetAttribute' => null,  | 
            ||
| 144 | 'targetValueOrAttribute' => 'YES',  | 
            ||
| 145 | ],  | 
            ||
| 146 | ],  | 
            ||
| 147 | 'incorrectDataSetTypeMessage' => [  | 
            ||
| 148 | 'template' => 'The attribute value returned from a custom data set must have a scalar type.',  | 
            ||
| 149 | 'parameters' => [  | 
            ||
| 150 | 'targetValue' => 'YES',  | 
            ||
| 151 | 'targetAttribute' => null,  | 
            ||
| 152 | 'targetValueOrAttribute' => 'YES',  | 
            ||
| 153 | ],  | 
            ||
| 154 | ],  | 
            ||
| 155 | 'message' => [  | 
            ||
| 156 |                         'template' => 'Value must be equal to "{targetValueOrAttribute}".', | 
            ||
| 157 | 'parameters' => [  | 
            ||
| 158 | 'targetValue' => 'YES',  | 
            ||
| 159 | 'targetAttribute' => null,  | 
            ||
| 160 | 'targetValueOrAttribute' => 'YES',  | 
            ||
| 161 | ],  | 
            ||
| 162 | ],  | 
            ||
| 163 | 'type' => 'string',  | 
            ||
| 164 | 'operator' => '===',  | 
            ||
| 165 | 'skipOnEmpty' => false,  | 
            ||
| 166 | 'skipOnError' => false,  | 
            ||
| 167 | ],  | 
            ||
| 168 | ],  | 
            ||
| 169 | [  | 
            ||
| 170 |                 new Equal('YES', skipOnEmpty: true), | 
            ||
| 171 | [  | 
            ||
| 172 | 'targetValue' => 'YES',  | 
            ||
| 173 | 'targetAttribute' => null,  | 
            ||
| 174 | 'incorrectInputMessage' => [  | 
            ||
| 175 | 'template' => 'The allowed types are integer, float, string, boolean and null.',  | 
            ||
| 176 | 'parameters' => [  | 
            ||
| 177 | 'targetValue' => 'YES',  | 
            ||
| 178 | 'targetAttribute' => null,  | 
            ||
| 179 | 'targetValueOrAttribute' => 'YES',  | 
            ||
| 180 | ],  | 
            ||
| 181 | ],  | 
            ||
| 182 | 'incorrectDataSetTypeMessage' => [  | 
            ||
| 183 | 'template' => 'The attribute value returned from a custom data set must have a scalar type.',  | 
            ||
| 184 | 'parameters' => [  | 
            ||
| 185 | 'targetValue' => 'YES',  | 
            ||
| 186 | 'targetAttribute' => null,  | 
            ||
| 187 | 'targetValueOrAttribute' => 'YES',  | 
            ||
| 188 | ],  | 
            ||
| 189 | ],  | 
            ||
| 190 | 'message' => [  | 
            ||
| 191 |                         'template' => 'Value must be equal to "{targetValueOrAttribute}".', | 
            ||
| 192 | 'parameters' => [  | 
            ||
| 193 | 'targetValue' => 'YES',  | 
            ||
| 194 | 'targetAttribute' => null,  | 
            ||
| 195 | 'targetValueOrAttribute' => 'YES',  | 
            ||
| 196 | ],  | 
            ||
| 197 | ],  | 
            ||
| 198 | 'type' => 'string',  | 
            ||
| 199 | 'operator' => '==',  | 
            ||
| 200 | 'skipOnEmpty' => true,  | 
            ||
| 201 | 'skipOnError' => false,  | 
            ||
| 202 | ],  | 
            ||
| 203 | ],  | 
            ||
| 204 | [  | 
            ||
| 205 | new Equal(null, 'attribute'),  | 
            ||
| 206 | [  | 
            ||
| 207 | 'targetValue' => null,  | 
            ||
| 208 | 'targetAttribute' => 'attribute',  | 
            ||
| 209 | 'incorrectInputMessage' => [  | 
            ||
| 210 | 'template' => 'The allowed types are integer, float, string, boolean and null.',  | 
            ||
| 211 | 'parameters' => [  | 
            ||
| 212 | 'targetValue' => null,  | 
            ||
| 213 | 'targetAttribute' => 'attribute',  | 
            ||
| 214 | 'targetValueOrAttribute' => 'attribute',  | 
            ||
| 215 | ],  | 
            ||
| 216 | ],  | 
            ||
| 217 | 'incorrectDataSetTypeMessage' => [  | 
            ||
| 218 | 'template' => 'The attribute value returned from a custom data set must have a scalar type.',  | 
            ||
| 219 | 'parameters' => [  | 
            ||
| 220 | 'targetValue' => null,  | 
            ||
| 221 | 'targetAttribute' => 'attribute',  | 
            ||
| 222 | 'targetValueOrAttribute' => 'attribute',  | 
            ||
| 223 | ],  | 
            ||
| 224 | ],  | 
            ||
| 225 | 'message' => [  | 
            ||
| 226 |                         'template' => 'Value must be equal to "{targetValueOrAttribute}".', | 
            ||
| 227 | 'parameters' => [  | 
            ||
| 228 | 'targetValue' => null,  | 
            ||
| 229 | 'targetAttribute' => 'attribute',  | 
            ||
| 230 | 'targetValueOrAttribute' => 'attribute',  | 
            ||
| 231 | ],  | 
            ||
| 232 | ],  | 
            ||
| 233 | 'type' => 'string',  | 
            ||
| 234 | 'operator' => '==',  | 
            ||
| 235 | 'skipOnEmpty' => false,  | 
            ||
| 236 | 'skipOnError' => false,  | 
            ||
| 237 | ],  | 
            ||
| 238 | ],  | 
            ||
| 239 | [  | 
            ||
| 240 | new Equal(  | 
            ||
| 241 | targetAttribute: 'test',  | 
            ||
| 242 | incorrectInputMessage: 'Custom message 1.',  | 
            ||
| 243 | incorrectDataSetTypeMessage: 'Custom message 2.',  | 
            ||
| 244 | message: 'Custom message 3.',  | 
            ||
| 245 | ),  | 
            ||
| 246 | [  | 
            ||
| 247 | 'targetValue' => null,  | 
            ||
| 248 | 'targetAttribute' => 'test',  | 
            ||
| 249 | 'incorrectInputMessage' => [  | 
            ||
| 250 | 'template' => 'Custom message 1.',  | 
            ||
| 251 | 'parameters' => [  | 
            ||
| 252 | 'targetValue' => null,  | 
            ||
| 253 | 'targetAttribute' => 'test',  | 
            ||
| 254 | 'targetValueOrAttribute' => 'test',  | 
            ||
| 255 | ],  | 
            ||
| 256 | ],  | 
            ||
| 257 | 'incorrectDataSetTypeMessage' => [  | 
            ||
| 258 | 'template' => 'Custom message 2.',  | 
            ||
| 259 | 'parameters' => [  | 
            ||
| 260 | 'targetValue' => null,  | 
            ||
| 261 | 'targetAttribute' => 'test',  | 
            ||
| 262 | 'targetValueOrAttribute' => 'test',  | 
            ||
| 263 | ],  | 
            ||
| 264 | ],  | 
            ||
| 265 | 'message' => [  | 
            ||
| 266 | 'template' => 'Custom message 3.',  | 
            ||
| 267 | 'parameters' => [  | 
            ||
| 268 | 'targetValue' => null,  | 
            ||
| 269 | 'targetAttribute' => 'test',  | 
            ||
| 270 | 'targetValueOrAttribute' => 'test',  | 
            ||
| 271 | ],  | 
            ||
| 272 | ],  | 
            ||
| 273 | 'type' => 'string',  | 
            ||
| 274 | 'operator' => '==',  | 
            ||
| 275 | 'skipOnEmpty' => false,  | 
            ||
| 276 | 'skipOnError' => false,  | 
            ||
| 277 | ],  | 
            ||
| 312 |