| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 47 | 3 | public function once(callable $callback, $unique = null) |
|
| 48 | { |
||
| 49 | 3 | $_ = (string)$this->_unique($callback, $unique); |
|
| 50 | |||
| 51 | 3 | if (empty($this->instances[$_])) |
|
| 52 | { |
||
| 53 | 3 | $this->instances[$_] = |
|
| 54 | 3 | $unique instanceof Slice ? |
|
| 55 | 1 | $callback($unique) : |
|
| 56 | 2 | $callback(); |
|
| 57 | } |
||
| 58 | |||
| 59 | 3 | return $this->instances[$_]; |
|
| 60 | } |
||
| 63 |