summaryrefslogtreecommitdiff
path: root/src/Filesystem/CreateDirectory.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Filesystem/CreateDirectory.php')
-rw-r--r--src/Filesystem/CreateDirectory.php21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/Filesystem/CreateDirectory.php b/src/Filesystem/CreateDirectory.php
index c74cba4..64c5fba 100644
--- a/src/Filesystem/CreateDirectory.php
+++ b/src/Filesystem/CreateDirectory.php
@@ -16,7 +16,12 @@ class CreateDirectory
*/
protected $thing = "directory";
- protected $filename;
+ /**
+ * Directory to create
+ *
+ * @var string
+ */
+ protected $directory;
/**
* Check if the directory already exists
@@ -24,16 +29,16 @@ class CreateDirectory
* @param string $filename
* @author Phil Burton <phil@d3r.com>
*/
- public function __construct(string $filename)
+ public function __construct(string $directory)
{
- $this->filename = $filename;
+ $this->directory = $directory;
- if (!is_writable(dirname($filename))) {
- throw new \Exception('Cannot create ' . $this->thing . ' at: ' . $filename);
+ if (!is_writable(dirname($directory))) {
+ throw new \Exception('Cannot create ' . $this->thing . ' at: ' . $directory);
}
- if (file_exists($filename)) {
- throw new \Exception('Directory already exists at: ' . $filename);
+ if (file_exists($directory)) {
+ throw new \Exception('Directory already exists at: ' . $directory);
}
}
@@ -44,6 +49,6 @@ class CreateDirectory
*/
public function execute()
{
- mkdir($this->filename);
+ mkdir($this->directory);
}
}