protected function createDirectory($directory) { $umask = umask(0); $created = mkdir($directory, 0777, true); umask($umask); if (!$created) { throw new StorageException(StorageException::DIRECTORY_COULD_NOT_BE_CREATED, [$directory]); } }