| Conditions | 4 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 34 | 5 | public function handle(?\PDO $pdo, callable $callback): void |
|
| 35 | { |
||
| 36 | 5 | if (is_null($pdo)) { |
|
| 37 | 1 | return; |
|
| 38 | } |
||
| 39 | |||
| 40 | 4 | $objectHash = spl_object_hash($pdo); |
|
| 41 | 4 | $offset = date('P'); |
|
| 42 | |||
| 43 | 4 | if ($this->objectHash !== $objectHash || $this->currentOffset !== $offset) { |
|
| 44 | 4 | call_user_func($callback, $offset); |
|
| 45 | |||
| 46 | 4 | $this->objectHash = $objectHash; |
|
| 47 | 4 | $this->currentOffset = $offset; |
|
| 48 | } |
||
| 51 |