| Total Complexity | 5 |
| Total Lines | 60 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | class DestructibleString |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @var string |
||
| 19 | */ |
||
| 20 | private $string; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var callable |
||
| 24 | */ |
||
| 25 | private $callback; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @see LibFs::rmDir |
||
| 29 | * |
||
| 30 | * @param string $string |
||
| 31 | * |
||
| 32 | * @return DestructibleString |
||
| 33 | */ |
||
| 34 | 1 | public static function rmDir($string) |
|
| 35 | { |
||
| 36 | 1 | return new self( |
|
| 37 | 1 | $string, |
|
| 38 | 1 | 'Ktomk\Pipelines\LibFs::rmDir' |
|
| 39 | ); |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @param string $string |
||
| 44 | * |
||
| 45 | * @return self |
||
| 46 | */ |
||
| 47 | 1 | public static function rm($string) |
|
| 48 | { |
||
| 49 | 1 | return new self( |
|
| 50 | 1 | $string, |
|
| 51 | 1 | 'Ktomk\Pipelines\LibFs::rm' |
|
| 52 | ); |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * DestructibleString constructor. |
||
| 57 | * |
||
| 58 | * @param string $string |
||
| 59 | * @param callable $callback |
||
| 60 | */ |
||
| 61 | 3 | public function __construct($string, $callback) |
|
| 65 | 3 | } |
|
| 66 | |||
| 67 | 3 | public function __destruct() |
|
| 68 | { |
||
| 69 | 3 | call_user_func($this->callback, $this->string); |
|
| 70 | 3 | } |
|
| 71 | |||
| 72 | 4 | public function __toString() |
|
| 75 | } |
||
| 76 | } |
||
| 77 |