Total Complexity | 7 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
5 | class FilePath |
||
6 | { |
||
7 | private $filepath = null; |
||
8 | |||
9 | private $directories = null; |
||
10 | private $file = null; |
||
11 | private $file_extension = null; |
||
12 | |||
13 | private $already_parsed = false; |
||
14 | |||
15 | public function __construct($filepath) |
||
16 | { |
||
17 | $this->filepath = $filepath; |
||
18 | } |
||
19 | |||
20 | public function __toString() |
||
21 | { |
||
22 | return '' . $this->filepath; |
||
23 | } |
||
24 | |||
25 | public function dir(): string |
||
26 | { |
||
27 | $this->parse(); |
||
28 | return $this->directories; |
||
29 | } |
||
30 | |||
31 | public function file(): string |
||
32 | { |
||
33 | $this->parse(); |
||
34 | return $this->file; |
||
35 | } |
||
36 | |||
37 | public function ext(): string |
||
38 | { |
||
39 | $this->parse(); |
||
40 | return $this->file_extension; |
||
41 | } |
||
42 | |||
43 | private function parse(): FilePath |
||
56 | } |
||
57 | } |
||
58 | |||
59 | // mime_content_type() - Detect MIME Content-type for a file |
||
60 | // stat() |
||
61 |