1 | <?php |
||
20 | class FilePath |
||
21 | { |
||
22 | |||
23 | /** |
||
24 | * @var string file_path |
||
25 | */ |
||
26 | private $file_path; |
||
27 | |||
28 | |||
29 | /** |
||
30 | * FilePath constructor. |
||
31 | * |
||
32 | * @param string $file_path |
||
33 | * @throws InvalidDataTypeException |
||
34 | * @throws InvalidFilePathException |
||
35 | */ |
||
36 | public function __construct($file_path) |
||
37 | { |
||
38 | if (! is_string($file_path)) { |
||
39 | throw new InvalidDataTypeException( |
||
40 | '$file_path', |
||
41 | $file_path, |
||
42 | 'string' |
||
43 | ); |
||
44 | } |
||
45 | if (! is_readable($file_path)) { |
||
46 | throw new InvalidFilePathException($file_path); |
||
47 | } |
||
48 | $this->file_path = $file_path; |
||
49 | } |
||
50 | |||
51 | |||
52 | /** |
||
53 | * @return string |
||
54 | */ |
||
55 | public function __toString() |
||
59 | |||
60 | |||
61 | } |
||
62 |