| Conditions | 1 |
| Paths | 1 |
| Total Lines | 126 |
| Code Lines | 57 |
| 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 |
||
| 22 | public static function executeQueryProvider() : iterable |
||
| 23 | { |
||
| 24 | return [ |
||
| 25 | [ |
||
| 26 | 'SELECT * FROM ddc1372_foobar f WHERE f.foo = :foo AND f.bar IN (:bar)', |
||
| 27 | [ |
||
| 28 | 'foo' => 1, |
||
| 29 | 'bar' => [1, 2, 3], |
||
| 30 | ], |
||
| 31 | [ |
||
| 32 | 'foo' => ParameterType::INTEGER, |
||
| 33 | 'bar' => Connection::PARAM_INT_ARRAY, |
||
| 34 | ], |
||
| 35 | [ |
||
| 36 | ['id' => 1, 'foo' => 1, 'bar' => 1], |
||
| 37 | ['id' => 2, 'foo' => 1, 'bar' => 2], |
||
| 38 | ['id' => 3, 'foo' => 1, 'bar' => 3], |
||
| 39 | ], |
||
| 40 | ], |
||
| 41 | |||
| 42 | [ |
||
| 43 | 'SELECT * FROM ddc1372_foobar f WHERE f.foo = :foo AND f.bar IN (:bar)', |
||
| 44 | [ |
||
| 45 | 'foo' => 1, |
||
| 46 | 'bar' => [1, 2, 3], |
||
| 47 | ], |
||
| 48 | [ |
||
| 49 | 'bar' => Connection::PARAM_INT_ARRAY, |
||
| 50 | 'foo' => ParameterType::INTEGER, |
||
| 51 | ], |
||
| 52 | [ |
||
| 53 | ['id' => 1, 'foo' => 1, 'bar' => 1], |
||
| 54 | ['id' => 2, 'foo' => 1, 'bar' => 2], |
||
| 55 | ['id' => 3, 'foo' => 1, 'bar' => 3], |
||
| 56 | ], |
||
| 57 | ], |
||
| 58 | |||
| 59 | [ |
||
| 60 | 'SELECT * FROM ddc1372_foobar f WHERE f.bar IN (:bar) AND f.foo = :foo', |
||
| 61 | [ |
||
| 62 | 'foo' => 1, |
||
| 63 | 'bar' => [1, 2, 3], |
||
| 64 | ], |
||
| 65 | [ |
||
| 66 | 'bar' => Connection::PARAM_INT_ARRAY, |
||
| 67 | 'foo' => ParameterType::INTEGER, |
||
| 68 | ], |
||
| 69 | [ |
||
| 70 | ['id' => 1, 'foo' => 1, 'bar' => 1], |
||
| 71 | ['id' => 2, 'foo' => 1, 'bar' => 2], |
||
| 72 | ['id' => 3, 'foo' => 1, 'bar' => 3], |
||
| 73 | ], |
||
| 74 | ], |
||
| 75 | |||
| 76 | [ |
||
| 77 | 'SELECT * FROM ddc1372_foobar f WHERE f.bar IN (:bar) AND f.foo = :foo', |
||
| 78 | [ |
||
| 79 | 'foo' => 1, |
||
| 80 | 'bar' => ['1', '2', '3'], |
||
| 81 | ], |
||
| 82 | [ |
||
| 83 | 'bar' => Connection::PARAM_STR_ARRAY, |
||
| 84 | 'foo' => ParameterType::INTEGER, |
||
| 85 | ], |
||
| 86 | [ |
||
| 87 | ['id' => 1, 'foo' => 1, 'bar' => 1], |
||
| 88 | ['id' => 2, 'foo' => 1, 'bar' => 2], |
||
| 89 | ['id' => 3, 'foo' => 1, 'bar' => 3], |
||
| 90 | ], |
||
| 91 | ], |
||
| 92 | |||
| 93 | [ |
||
| 94 | 'SELECT * FROM ddc1372_foobar f WHERE f.bar IN (:bar) AND f.foo IN (:foo)', |
||
| 95 | [ |
||
| 96 | 'foo' => ['1'], |
||
| 97 | 'bar' => [1, 2, 3, 4], |
||
| 98 | ], |
||
| 99 | [ |
||
| 100 | 'bar' => Connection::PARAM_STR_ARRAY, |
||
| 101 | 'foo' => Connection::PARAM_INT_ARRAY, |
||
| 102 | ], |
||
| 103 | [ |
||
| 104 | ['id' => 1, 'foo' => 1, 'bar' => 1], |
||
| 105 | ['id' => 2, 'foo' => 1, 'bar' => 2], |
||
| 106 | ['id' => 3, 'foo' => 1, 'bar' => 3], |
||
| 107 | ['id' => 4, 'foo' => 1, 'bar' => 4], |
||
| 108 | ], |
||
| 109 | ], |
||
| 110 | |||
| 111 | [ |
||
| 112 | 'SELECT * FROM ddc1372_foobar f WHERE f.bar IN (:bar) AND f.foo IN (:foo)', |
||
| 113 | [ |
||
| 114 | 'foo' => 1, |
||
| 115 | 'bar' => 2, |
||
| 116 | ], |
||
| 117 | [ |
||
| 118 | 'bar' => ParameterType::INTEGER, |
||
| 119 | 'foo' => ParameterType::INTEGER, |
||
| 120 | ], |
||
| 121 | [ |
||
| 122 | ['id' => 2, 'foo' => 1, 'bar' => 2], |
||
| 123 | ], |
||
| 124 | ], |
||
| 125 | |||
| 126 | [ |
||
| 127 | 'SELECT * FROM ddc1372_foobar f WHERE f.bar = :arg AND f.foo <> :arg', |
||
| 128 | ['arg' => '1'], |
||
| 129 | [ |
||
| 130 | 'arg' => ParameterType::STRING, |
||
| 131 | ], |
||
| 132 | [ |
||
| 133 | ['id' => 5, 'foo' => 2, 'bar' => 1], |
||
| 134 | ], |
||
| 135 | ], |
||
| 136 | |||
| 137 | [ |
||
| 138 | 'SELECT * FROM ddc1372_foobar f WHERE f.bar NOT IN (:arg) AND f.foo IN (:arg)', |
||
| 139 | [ |
||
| 140 | 'arg' => [1, 2], |
||
| 141 | ], |
||
| 142 | [ |
||
| 143 | 'arg' => Connection::PARAM_INT_ARRAY, |
||
| 144 | ], |
||
| 145 | [ |
||
| 146 | ['id' => 3, 'foo' => 1, 'bar' => 3], |
||
| 147 | ['id' => 4, 'foo' => 1, 'bar' => 4], |
||
| 148 | ], |
||
| 291 |