Total Complexity | 4 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 3 | ||
Bugs | 0 | Features | 2 |
1 | <?php |
||
5 | class Tmp |
||
6 | { |
||
7 | |||
8 | /** |
||
9 | * @var string |
||
10 | */ |
||
11 | protected $file; |
||
12 | |||
13 | /** |
||
14 | * Tmp constructor. |
||
15 | */ |
||
16 | 5 | public function __construct() |
|
17 | { |
||
18 | 5 | $this->file = tempnam(sys_get_temp_dir(), 'bavix'); |
|
19 | 5 | \touch($this->file); |
|
20 | |||
21 | 5 | register_shutdown_function([$this, '__destruct']); |
|
22 | 5 | } |
|
23 | |||
24 | 1 | public function __destruct() |
|
25 | { |
||
26 | 1 | if (file_exists($this->file)) |
|
27 | { |
||
28 | 1 | unlink($this->file); |
|
29 | } |
||
30 | 1 | } |
|
31 | |||
32 | 5 | public function __toString() |
|
35 | } |
||
36 | |||
37 | } |
||
38 |