Newscoop\Storage::createDir PHP Метод

createDir() публичный Метод

Create dir
public createDir ( string $key ) : void
$key string
Результат void
    public function createDir($key)
    {
        $path = $this->getPath($key);
        if (realpath($path) || !mkdir($path)) {
            throw new \InvalidArgumentException($key);
        }
    }

Usage Example

Пример #1
0
 /**
  * Create folder
  *
  * @param string $name
  * @return void
  * @throws InvalidArgumentException
  */
 public function createFolder($name)
 {
     try {
         $this->storage->createDir($name);
     } catch (\InvalidArgumentException $e) {
         throw new \InvalidArgumentException(sprintf('A file or folder having the name %s already exists', $name), $e->getCode(), $e);
     }
 }