Conditions | 1 |
Paths | 1 |
Total Lines | 67 |
Code Lines | 2 |
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 |
||
130 | private static function informationSchemaQuery(string $database): string |
||
131 | { |
||
132 | return "SELECT |
||
133 | `t`.`TABLE_NAME` AS `table`, |
||
134 | `c`.`COLUMN_NAME` AS `column`, |
||
135 | `c`.`COLUMN_DEFAULT` AS `default`, |
||
136 | `c`.`COLUMN_TYPE` AS `column_type`, |
||
137 | |||
138 | CASE |
||
139 | WHEN `c`.`IS_NULLABLE` = 'YES' THEN 1 |
||
140 | ELSE NULL |
||
141 | END AS `nullable`, |
||
142 | |||
143 | CASE |
||
144 | WHEN `c`.`DATA_TYPE` = 'bit' AND `c`.`NUMERIC_PRECISION` = 1 THEN 'boolean' |
||
145 | WHEN `c`.`DATA_TYPE` IN ('bit', 'tinyint', 'smallint', 'mediumint', 'int', 'bigint') THEN 'integer' |
||
146 | WHEN `c`.`DATA_TYPE` IN ('float', 'double', 'real') THEN 'float' |
||
147 | WHEN `c`.`DATA_TYPE` IN ('decimal', 'numeric') THEN 'decimal' |
||
148 | WHEN `c`.`DATA_TYPE` IN ('char', 'varchar') THEN 'string' |
||
149 | WHEN `c`.`DATA_TYPE` IN ('text', 'tinytext', 'mediumtext', 'longtext') THEN 'text' |
||
150 | WHEN `c`.`DATA_TYPE` = 'date' THEN 'date' |
||
151 | WHEN `c`.`DATA_TYPE` = 'datetime' THEN 'datetime' |
||
152 | WHEN `c`.`DATA_TYPE` = 'timestamp' THEN 'timestamp' |
||
153 | WHEN `c`.`DATA_TYPE` = 'time' THEN 'time' |
||
154 | WHEN `c`.`DATA_TYPE` = 'year' THEN 'year' |
||
155 | WHEN `c`.`DATA_TYPE` = 'enum' THEN 'enum' |
||
156 | ELSE 'unknown' |
||
157 | END AS `type`, |
||
158 | |||
159 | `c`.`CHARACTER_MAXIMUM_LENGTH` AS `length`, |
||
160 | `c`.`NUMERIC_PRECISION` AS `precision`, |
||
161 | `c`.`NUMERIC_SCALE` AS `scale`, |
||
162 | |||
163 | CASE |
||
164 | WHEN `c`.`EXTRA` = 'auto_increment' THEN 1 |
||
165 | ELSE NULL |
||
166 | END AS `auto_increment`, |
||
167 | |||
168 | `tc`.`CONSTRAINT_TYPE` AS `constraint_type`, |
||
169 | `kcu`.`CONSTRAINT_NAME` AS `constraint`, |
||
170 | `kcu`.`REFERENCED_TABLE_NAME` AS `parent_table`, |
||
171 | `kcu`.`REFERENCED_COLUMN_NAME` AS `parent_column`, |
||
172 | `rc`.`DELETE_RULE` AS `delete_rule`, |
||
173 | `rc`.`UPDATE_RULE` AS `update_rule` |
||
174 | FROM |
||
175 | `INFORMATION_SCHEMA`.`TABLES` AS `t` |
||
176 | JOIN |
||
177 | `INFORMATION_SCHEMA`.`COLUMNS` AS `c` |
||
178 | ON `t`.`TABLE_NAME` = `c`.`TABLE_NAME` |
||
179 | AND `t`.`TABLE_SCHEMA` = `c`.`TABLE_SCHEMA` |
||
180 | LEFT JOIN |
||
181 | `INFORMATION_SCHEMA`.`KEY_COLUMN_USAGE` AS `kcu` |
||
182 | ON `t`.`TABLE_NAME` = `kcu`.`TABLE_NAME` |
||
183 | AND `c`.`COLUMN_NAME` = `kcu`.`COLUMN_NAME` |
||
184 | AND `t`.`TABLE_SCHEMA` = `kcu`.`TABLE_SCHEMA` |
||
185 | LEFT JOIN |
||
186 | `INFORMATION_SCHEMA`.`TABLE_CONSTRAINTS` AS `tc` |
||
187 | ON `kcu`.`CONSTRAINT_NAME` = `tc`.`CONSTRAINT_NAME` |
||
188 | AND `kcu`.`TABLE_SCHEMA` = `tc`.`CONSTRAINT_SCHEMA` |
||
189 | AND `t`.`TABLE_NAME` = `tc`.`TABLE_NAME` |
||
190 | LEFT JOIN |
||
191 | `INFORMATION_SCHEMA`.`REFERENTIAL_CONSTRAINTS` AS `rc` |
||
192 | ON `kcu`.`CONSTRAINT_NAME` = `rc`.`CONSTRAINT_NAME` |
||
193 | AND `kcu`.`TABLE_SCHEMA` = `rc`.`CONSTRAINT_SCHEMA` |
||
194 | AND `t`.`TABLE_NAME` = `rc`.`TABLE_NAME` |
||
195 | WHERE |
||
196 | `t`.`TABLE_SCHEMA` = '$database' |
||
197 | AND `t`.`TABLE_TYPE` = 'BASE TABLE' |
||
203 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths