1 | <?php |
||
16 | final class Folder |
||
17 | { |
||
18 | /** @var FilesystemPath */ |
||
19 | private $folder; |
||
20 | |||
21 | /** |
||
22 | * @param string $folderPath |
||
23 | */ |
||
24 | 12 | public function __construct($folderPath) |
|
33 | |||
34 | public function __toString() |
||
38 | |||
39 | /** |
||
40 | * Set a base folder that will be prefixed before all file writes and copies. |
||
41 | * |
||
42 | * @param string $folderName |
||
43 | * |
||
44 | * @since 0.1.0 |
||
45 | */ |
||
46 | public function setTargetDirectory($folderName) |
||
55 | |||
56 | /** |
||
57 | * Copy a file from an absolute file to a path relative to the Folder's location. |
||
58 | * |
||
59 | * @param string $absolutePath The absolute path of the file |
||
60 | * @param string $targetPath The relative file path to the Folder's location |
||
61 | * |
||
62 | * @since 0.1.0 |
||
63 | */ |
||
64 | public function copyFile($absolutePath, $targetPath) |
||
70 | |||
71 | /** |
||
72 | * Write a file with the specified content. |
||
73 | * |
||
74 | * @param string $relativePath The file path relative to this Folder's location |
||
75 | * @param string $content The content that will be written to the file |
||
76 | * |
||
77 | * @since 0.1.0 |
||
78 | * |
||
79 | * @return File |
||
80 | */ |
||
81 | 12 | public function writeFile($relativePath, $content) |
|
95 | } |
||
96 |