| Conditions | 10 |
| Paths | 5 |
| Total Lines | 30 |
| Code Lines | 17 |
| 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 |
||
| 15 | public static function isIndexLengthLimited(string $name, Connection $connection): bool |
||
| 16 | { |
||
| 17 | $columns = SchemaHelper::getAuditTableColumns(); |
||
| 18 | if ( |
||
| 19 | !isset($columns[$name]) |
||
| 20 | || $columns[$name]['type'] !== DoctrineHelper::getDoctrineType('STRING') |
||
| 21 | || ( |
||
| 22 | isset($columns[$name]['options'], $columns[$name]['options']['length']) |
||
| 23 | && $columns[$name]['options']['length'] < 191 |
||
| 24 | ) |
||
| 25 | ) { |
||
| 26 | return false; |
||
| 27 | } |
||
| 28 | |||
| 29 | $version = self::getServerVersion($connection); |
||
| 30 | |||
| 31 | if (null === $version) { |
||
| 32 | return false; |
||
| 33 | } |
||
| 34 | |||
| 35 | $mariadb = false !== mb_stripos($version, 'mariadb'); |
||
| 36 | if ($mariadb && version_compare(self::getMariaDbMysqlVersionNumber($version), '10.2.2', '<')) { |
||
| 37 | return true; |
||
| 38 | } |
||
| 39 | |||
| 40 | if (!$mariadb && version_compare(self::getOracleMysqlVersionNumber($version), '5.7.7', '<')) { |
||
| 41 | return true; |
||
| 42 | } |
||
| 43 | |||
| 44 | return false; |
||
| 45 | } |
||
| 122 |