summaryrefslogtreecommitdiff
path: root/src/Filesystem/CreateDirectory.php
diff options
context:
space:
mode:
authorFbenas <philbeansburton@gmail.com>2017-08-25 01:47:18 +0100
committerFbenas <philbeansburton@gmail.com>2017-08-25 01:47:18 +0100
commit903b671e7d6cc1c289be5dc7f356a9e5fb98dbf7 (patch)
tree005a8c4d9750fc4fe42667c166d000e20ecf21d2 /src/Filesystem/CreateDirectory.php
parentd082907cb71f568da01e1f22a2c4eab1e3ced7aa (diff)
Add config and config loader and remove requirement of trailing slashes in config values
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);
}
}