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);
     }
 }