| Total Complexity | 6 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 16 | class Cache |
||
| 17 | { |
||
| 18 | private $value = null; |
||
| 19 | private $containerType; |
||
| 20 | private $propertyType; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Cache constructor. |
||
| 24 | * @param string $tContainer Type of the element that contains the cached property |
||
| 25 | * @param string $tProperty Type of the cached property |
||
| 26 | */ |
||
| 27 | public function __construct(string $tContainer, string $tProperty) |
||
| 28 | { |
||
| 29 | $this->containerType = $tContainer; |
||
| 30 | $this->propertyType = $tProperty; |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * In order to detect the boundaries of a cycle, we use two sentinel values. When we encounter the first |
||
| 35 | * sentinel, we know that a cycle exists and that we are a point on that cycle. |
||
| 36 | * When we reach an instance of the second sentinel, we know we have made a complete circuit of the cycle and that |
||
| 37 | * every node in the cycle has been marked with the second sentinel. |
||
| 38 | * @param mixed $container |
||
| 39 | * @param callable $compute |
||
| 40 | * @return mixed; |
||
| 41 | */ |
||
| 42 | public function getValue($container, callable $compute) |
||
| 43 | { |
||
| 44 | if ($this->value === CacheHelper::getUnknown()) { |
||
|
|
|||
| 45 | $this->value = $compute($container); |
||
| 46 | } |
||
| 47 | return $this->value; |
||
| 48 | } |
||
| 49 | |||
| 50 | public function clear(): void |
||
| 54 | } |
||
| 55 | } |
||
| 56 | } |
||
| 57 |
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.