Tmp   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 2
Metric Value
eloc 8
c 3
b 0
f 2
dl 0
loc 30
ccs 11
cts 11
cp 1
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 3 1
A __destruct() 0 5 2
A __construct() 0 6 1
1
<?php
2
3
namespace Bavix\Tests;
4
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()
33
    {
34 5
        return (string)$this->file;
35
    }
36
37
}
38