1 | <?php |
||
18 | class File extends \SplFileInfo |
||
19 | { |
||
20 | /** |
||
21 | * Constructs a new file from the given path. |
||
22 | * |
||
23 | * @param string $path The path to the file |
||
24 | * @param boolean $check Whether to check the path or not |
||
25 | * |
||
26 | * @throws \OutOfRangeException If the given path is not a file |
||
27 | */ |
||
28 | public function __construct($path, $check = true) |
||
36 | |||
37 | /** |
||
38 | * Returns the extension of the file. |
||
39 | * SplFileInfo::getExtension() is not available before PHP 5.3.6 |
||
40 | * |
||
41 | * @return string |
||
42 | */ |
||
43 | public function getExtension() |
||
47 | |||
48 | /** |
||
49 | * Moves the file to a new location. |
||
50 | * |
||
51 | * @param string $dir The destination folder |
||
52 | * @param string $name The new file name |
||
53 | * |
||
54 | * @return File A File object representing the new file |
||
55 | * @throws \RuntimeException if the target file could not be created |
||
56 | */ |
||
57 | public function move($dir, $name = null) |
||
67 | |||
68 | /** |
||
69 | * @param string $dir The destination folder |
||
70 | * @param null|string $name |
||
71 | * |
||
72 | * @return File |
||
73 | * @throws \RuntimeException |
||
74 | */ |
||
75 | protected function getTargetFile($dir, $name = null) |
||
87 | |||
88 | /** |
||
89 | * Returns locale independent base name of the given path. |
||
90 | * |
||
91 | * @param string $name The new file name |
||
92 | * |
||
93 | * @return string |
||
94 | */ |
||
95 | protected function getName($name) |
||
102 | } |
||
103 |