Filesystem::unlink()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Hgraca\DoctrineTestDbRegenerationBundle\StdLib;
6
7
use Directory;
8
9
final class Filesystem extends AbstractStaticClass
10
{
11
    use NativeOverride;
12
13 22
    public static function filemtime(string $filePath): int
14
    {
15 22
        if (isset(self::$overrideList['filemtime'])) {
16 12
            return (self::$overrideList['filemtime'])($filePath);
17
        }
18
19 10
        return \filemtime($filePath);
20
    }
21
22 12
    public static function override_filemtime(callable $callable): void
23
    {
24 12
        self::override('filemtime', $callable);
25 12
    }
26
27 10
    public static function is_dir(string $filePath): bool
28
    {
29 10
        if (isset(self::$overrideList['is_dir'])) {
30 2
            return (self::$overrideList['is_dir'])($filePath);
31
        }
32
33 8
        return \is_dir($filePath);
34
    }
35
36 2
    public static function override_is_dir(callable $callable): void
37
    {
38 2
        self::override('is_dir', $callable);
39 2
    }
40
41 14
    public static function is_file(string $filePath): bool
42
    {
43 14
        if (isset(self::$overrideList['is_file'])) {
44 2
            return (self::$overrideList['is_file'])($filePath);
45
        }
46
47 12
        return \is_file($filePath);
48
    }
49
50 2
    public static function override_is_file(callable $callable): void
51
    {
52 2
        self::override('is_file', $callable);
53 2
    }
54
55 8
    public static function dir(string $filePath): Directory
56
    {
57 8
        if (isset(self::$overrideList['dir'])) {
58 2
            return (self::$overrideList['dir'])($filePath);
59
        }
60
61 6
        return \dir($filePath);
62
    }
63
64 2
    public static function override_dir(callable $callable): void
65
    {
66 2
        self::override('dir', $callable);
67 2
    }
68
69 14
    public static function file_exists(string $filePath): bool
70
    {
71 14
        if (isset(self::$overrideList['file_exists'])) {
72 12
            return (self::$overrideList['file_exists'])($filePath);
73
        }
74
75 2
        return \file_exists($filePath);
76
    }
77
78 14
    public static function override_file_exists(callable $callable): void
79
    {
80 14
        self::override('file_exists', $callable);
81 14
    }
82
83 10
    public static function rename(string $filePath, string $newFilePath): bool
84
    {
85 10
        if (isset(self::$overrideList['rename'])) {
86 8
            return (self::$overrideList['rename'])($filePath, $newFilePath);
87
        }
88
89 2
        return \rename($filePath, $newFilePath);
90
    }
91
92 8
    public static function override_rename(callable $callable): void
93
    {
94 8
        self::override('rename', $callable);
95 8
    }
96
97 6
    public static function copy(string $filePath, string $newFilePath): bool
98
    {
99 6
        if (isset(self::$overrideList['copy'])) {
100 4
            return (self::$overrideList['copy'])($filePath, $newFilePath);
101
        }
102
103 2
        return \copy($filePath, $newFilePath);
104
    }
105
106 4
    public static function override_copy(callable $callable): void
107
    {
108 4
        self::override('copy', $callable);
109 4
    }
110
111 4
    public static function unlink(string $filePath): bool
112
    {
113 4
        if (isset(self::$overrideList['unlink'])) {
114 2
            return (self::$overrideList['unlink'])($filePath);
115
        }
116
117 2
        return \unlink($filePath);
118
    }
119
120 4
    public static function override_unlink(callable $callable): void
121
    {
122 4
        self::override('unlink', $callable);
123 4
    }
124
}
125