| Conditions | 12 |
| Paths | 10 |
| Total Lines | 43 |
| Code Lines | 25 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| 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 |
||
| 97 | private static function getPrefixedAdapter(string $connection, $adapter) |
||
| 98 | { |
||
| 99 | $connection = \parse_url($connection) ?: \explode('://', $connection, 2) ?: []; |
||
| 100 | |||
| 101 | // Extract parsed connection string. |
||
| 102 | list($scheme, $host, $port) = [ |
||
| 103 | $connection['scheme'] ?? $connection[0] ?? null, |
||
| 104 | $connection['host'] ?? $connection[1] ?? null, |
||
| 105 | $connection['port'] ?? null, |
||
| 106 | ]; |
||
| 107 | |||
| 108 | if (isset($scheme, $host)) { |
||
| 109 | switch ($connectionServer = \ucfirst($scheme)) { |
||
| 110 | case 'Redis': |
||
| 111 | ($adapter = new \Redis())->connect($host, $port ?? 6379); |
||
| 112 | |||
| 113 | break; |
||
| 114 | |||
| 115 | case 'sqlite': |
||
| 116 | $adapter = new DoctrineCache\SQLite3Cache(new \SQLite3($host), 'doctrine_cache'); |
||
| 117 | |||
| 118 | break; |
||
| 119 | |||
| 120 | case 'Memcache': |
||
| 121 | case 'Memcache': |
||
| 122 | /** @var \Memcache|\Memcached $adapter */ |
||
| 123 | ($adapter = new $connectionServer())->addServer($host, $port ?? 11211); |
||
| 124 | |||
| 125 | break; |
||
| 126 | |||
| 127 | case 'Serialize': |
||
| 128 | case 'Serialise': |
||
| 129 | $adapter = new DoctrineCache\PhpFileCache($host); |
||
| 130 | |||
| 131 | break; |
||
| 132 | |||
| 133 | case 'Filesystem': |
||
| 134 | case 'File': |
||
| 135 | $adapter = new DoctrineCache\FilesystemCache($host); |
||
| 136 | } |
||
| 137 | } |
||
| 138 | |||
| 139 | return $adapter; |
||
| 140 | } |
||
| 142 |
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