| Conditions | 5 |
| Paths | 8 |
| Total Lines | 36 |
| Code Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 0 | ||
| 1 | <?php |
||
| 70 | protected function resolvePool($pool) |
||
| 71 | { |
||
| 72 | if (is_callable($pool)) { |
||
| 73 | $pool = $pool(); |
||
| 74 | } |
||
| 75 | |||
| 76 | if ($pool instanceof PoolInterface) { |
||
| 77 | return $pool; |
||
| 78 | } |
||
| 79 | |||
| 80 | if (!$class = ObjectHelper::findClassFromConfig($pool)) { |
||
| 81 | Craft::error( |
||
| 82 | sprintf( |
||
| 83 | "Could find cache pool class from config: %s", |
||
| 84 | Json::encode($pool) |
||
| 85 | ), |
||
| 86 | 'PSR-6' |
||
| 87 | ); |
||
| 88 | return null; |
||
| 89 | } |
||
| 90 | |||
| 91 | // Make sure we have a valid class |
||
| 92 | if (!is_subclass_of($class, PoolInterface::class)) { |
||
| 93 | Craft::error( |
||
| 94 | sprintf( |
||
| 95 | "Cache pool class '%s' is not an instances of %s", |
||
| 96 | (string)$class, |
||
| 97 | PoolInterface::class |
||
| 98 | ), |
||
| 99 | 'PSR-6' |
||
| 100 | ); |
||
| 101 | return null; |
||
| 102 | } |
||
| 103 | |||
| 104 | return $class($pool); |
||
| 105 | } |
||
| 106 | } |
||
| 107 |
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
The method
getObject()can return nothing but null, so it makes no sense to assign that value to a variable.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.