| Conditions | 1 |
| Paths | 1 |
| Total Lines | 107 |
| Code Lines | 52 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| 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 |
||
| 61 | public function insertProvider() |
||
| 62 | { |
||
| 63 | |||
| 64 | /** |
||
| 65 | * 1) Just insert |
||
| 66 | * 2) Insert empty index |
||
| 67 | * 3) Insert empty query |
||
| 68 | * 4) Insert with special symbols |
||
| 69 | * 5) Insert with tags as string without filter |
||
| 70 | * 6) Insert with tags as array of string without filter |
||
| 71 | * 7) Insert tags with special symbols |
||
| 72 | * 8) Insert with filter, withowt tags |
||
| 73 | * 9) Insert filter with special symbols |
||
| 74 | * 10) Insert two filters |
||
| 75 | * 11) Insert filter + tags |
||
| 76 | */ |
||
| 77 | |||
| 78 | |||
| 79 | return [ |
||
| 80 | [ |
||
| 81 | 1, |
||
| 82 | 'full text query terms', |
||
| 83 | 'pq', |
||
| 84 | null, |
||
| 85 | null, |
||
| 86 | "INSERT INTO pq (query) VALUES ('full text query terms')" |
||
| 87 | ], |
||
| 88 | |||
| 89 | [ |
||
| 90 | 2, |
||
| 91 | 'full text query terms', |
||
| 92 | null, |
||
| 93 | null, |
||
| 94 | null, |
||
| 95 | null |
||
| 96 | ], |
||
| 97 | |||
| 98 | [ |
||
| 99 | 3, |
||
| 100 | null, |
||
| 101 | 'pq', |
||
| 102 | null, |
||
| 103 | null, |
||
| 104 | null |
||
| 105 | ], |
||
| 106 | |||
| 107 | [ |
||
| 108 | 4, |
||
| 109 | '@doc (text) \' ^ $ " | ! ~ / = >< & - \query terms', |
||
| 110 | 'pq', |
||
| 111 | null, |
||
| 112 | null, |
||
| 113 | 'INSERT INTO pq (query) VALUES (\'@doc (text) \\\\\\\' ^ $ \\\\\\" | \\\\! \\\\~ \\\\/ = >\\\\< & \\\\- \\\\\\\\query terms\')' |
||
| 114 | ], |
||
| 115 | |||
| 116 | [ |
||
| 117 | 5, |
||
| 118 | '@subject match by field', |
||
| 119 | 'pq', |
||
| 120 | 'tag2,tag3', |
||
| 121 | 'price>3', |
||
| 122 | "INSERT INTO pq (query, tags, filters) VALUES ('@subject match by field', 'tag2,tag3', 'price>3')" |
||
| 123 | ], |
||
| 124 | |||
| 125 | [ |
||
| 126 | 6, |
||
| 127 | '@subject orange', |
||
| 128 | 'pq', |
||
| 129 | ['tag2', 'tag3'], |
||
| 130 | null, |
||
| 131 | "INSERT INTO pq (query, tags) VALUES ('@subject orange', 'tag2,tag3')" |
||
| 132 | ], |
||
| 133 | |||
| 134 | [ |
||
| 135 | 7, |
||
| 136 | '@subject orange', |
||
| 137 | 'pq', |
||
| 138 | '@doc (text) \' ^ $ " | ! ~ / = >< & - \query terms', |
||
| 139 | null, |
||
| 140 | 'INSERT INTO pq (query, tags) VALUES (\'@subject orange\', \'@doc (text) \\\\\\\' ^ $ \\\\\" | \\\\! \\\\~ \\\\/ = >\\\\< & \\\\- \\\\\\\\query terms\')' |
||
| 141 | ], |
||
| 142 | |||
| 143 | [ |
||
| 144 | 8, |
||
| 145 | 'catch me', |
||
| 146 | 'pq', |
||
| 147 | null, |
||
| 148 | 'price>3', |
||
| 149 | 'INSERT INTO pq (query, filters) VALUES (\'catch me\', \'price>3\')' |
||
| 150 | ], |
||
| 151 | |||
| 152 | [ |
||
| 153 | 9, |
||
| 154 | 'catch me if can', |
||
| 155 | 'pq', |
||
| 156 | null, |
||
| 157 | 'p\@r\'ice>3', |
||
| 158 | 'INSERT INTO pq (query, filters) VALUES (\'catch me if can\', \'price>3\')' |
||
| 159 | ], |
||
| 160 | |||
| 161 | [ |
||
| 162 | 11, |
||
| 163 | 'orange|apple|cherry', |
||
| 164 | 'pq', |
||
| 165 | ['tag2', 'tag3'], |
||
| 166 | 'price>3', |
||
| 167 | "INSERT INTO pq (query, tags, filters) VALUES ('orange|apple|cherry', 'tag2,tag3', 'price>3')" |
||
| 168 | ], |
||
| 287 |