From 903b671e7d6cc1c289be5dc7f356a9e5fb98dbf7 Mon Sep 17 00:00:00 2001 From: Fbenas Date: Fri, 25 Aug 2017 01:47:18 +0100 Subject: Add config and config loader and remove requirement of trailing slashes in config values --- src/Filesystem/CreateDirectory.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/Filesystem') 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 */ - 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); } } -- cgit v1.2.3