| Conditions | 11 |
| Paths | 19 |
| Total Lines | 49 |
| Code Lines | 27 |
| 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 |
||
| 40 | public static function createHandler($connection): CacheItemPoolInterface |
||
| 41 | { |
||
| 42 | static $adapter; |
||
| 43 | |||
| 44 | switch (true) { |
||
| 45 | case $connection instanceof DoctrineCache\Cache || $connection instanceof SymfonyDoctrineProvider: |
||
| 46 | return CacheAdapter::wrap($connection); |
||
| 47 | |||
| 48 | case \is_string($connection): |
||
| 49 | if (\in_array($connection, ['array', 'apcu', 'win-cache', 'zend-data'], true)) { |
||
| 50 | $adapter = \sprintf('Doctrine\Common\Cache\%sCache', \ucwords($connection, '-')); |
||
| 51 | |||
| 52 | return CacheAdapter::wrap(new $adapter()); |
||
| 53 | } |
||
| 54 | |||
| 55 | $connection = self::getPrefixedAdapter($connection, $adapter); |
||
| 56 | |||
| 57 | if ($connection instanceof DoctrineCache\Cache) { |
||
| 58 | return CacheAdapter::wrap($connection); |
||
| 59 | } |
||
| 60 | |||
| 61 | // no break |
||
| 62 | |||
| 63 | case $connection instanceof \Redis: |
||
| 64 | $adapter = new DoctrineCache\RedisCache(); |
||
| 65 | |||
| 66 | $adapter->setRedis($connection); |
||
| 67 | |||
| 68 | break; |
||
| 69 | |||
| 70 | case $connection instanceof \Memcache: |
||
| 71 | $adapter = new DoctrineCache\MemcacheCache(); |
||
| 72 | $adapter->setMemcache($connection); |
||
| 73 | |||
| 74 | break; |
||
| 75 | |||
| 76 | case $connection instanceof \Memcached: |
||
| 77 | $adapter = new DoctrineCache\MemcachedCache(); |
||
| 78 | $adapter->setMemcached($connection); |
||
| 79 | |||
| 80 | break; |
||
| 81 | } |
||
| 82 | |||
| 83 | if ($adapter instanceof DoctrineCache\Cache) { |
||
| 84 | return CacheAdapter::wrap($adapter); |
||
| 85 | } |
||
| 86 | |||
| 87 | throw new CacheException( |
||
| 88 | \sprintf('Unsupported Cache Adapter: %s.', \is_object($connection) ? \get_class($connection) : $connection) |
||
| 89 | ); |
||
| 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