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