Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 3 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| DestructTracerNode | |
0.00% |
0 / 3 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| __destruct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | declare( strict_types = 1 ); |
| 3 | |
| 4 | namespace Wikimedia\RemexHtml\TreeBuilder; |
| 5 | |
| 6 | class DestructTracerNode { |
| 7 | /** @var callable */ |
| 8 | private $callback; |
| 9 | /** @var string */ |
| 10 | private $tag; |
| 11 | |
| 12 | /** |
| 13 | * @param callable $callback |
| 14 | * @param string $tag |
| 15 | */ |
| 16 | public function __construct( $callback, $tag ) { |
| 17 | $this->callback = $callback; |
| 18 | $this->tag = $tag; |
| 19 | } |
| 20 | |
| 21 | public function __destruct() { |
| 22 | ( $this->callback )( "[Destruct] {$this->tag}" ); |
| 23 | } |
| 24 | } |