public static function make(string $path, int $ifExists = Directory::MAKE_DIRECTORY_EXISTS_THROW_EXCEPTION) : Directory
    {
        $exists = Directory::exists($path);

        if($exists) {
            if($ifExists === Directory::MAKE_DIRECTORY_EXISTS_OVERWRITE) {
                unlink($path);
            } else if($ifExists === Directory::MAKE_DIRECTORY_EXISTS_OPEN) {
                return new Directory($path);
            } else {
                throw new DirectoryAlreadyExists($path);
            }
        }

        if(!mkdir($path)) {
            throw new CouldntCreateDirectory($path);
        }

        return new Directory($path);
    }
public static function make(string $path, int $ifExists = Directory::MAKE_DIRECTORY_EXISTS_THROW_EXCEPTION) : Directory
    {
        $exists = Directory::exists($path);

        if($exists) {
            if($ifExists === Directory::MAKE_DIRECTORY_EXISTS_OVERWRITE) {
                unlink($path);
            } else if($ifExists === Directory::MAKE_DIRECTORY_EXISTS_OPEN) {
                return new Directory($path);
            } else {
                throw new DirectoryAlreadyExists($path);
            }
        }

        if(!mkdir($path)) {
            throw new CouldntCreateDirectory($path);
        }

        return new Directory($path);
    }
public static function make ( string $ path , int $ ifExists = Directory :: MAKE_DIRECTORY_EXISTS_THROW_EXCEPTION ) : Directory { $ exists = Directory :: exists ( $ path ) ; if ( $ exists ) { if ( $ ifExists === Directory :: MAKE_DIRECTORY_EXISTS_OVERWRITE ) { unlink ( $ path ) ; } else if ( $ ifExists === Directory :: MAKE_DIRECTORY_EXISTS_OPEN ) { return new Directory ( $ path ) ; } else { throw new DirectoryAlreadyExists ( $ path ) ; } } if ( ! mkdir ( $ path ) ) { throw new CouldntCreateDirectory ( $ path ) ; } return new Directory ( $ path ) ; }
Makes a directory.

The second parameter specifies what to do in case directory already exists:

* `\Alexya\FileSystem\Directory::MAKE_DIRECTORY_EXISTS_THROW_EXCEPTION`, throws an exception (default).
* `\Alexya\FileSystem\Directory::MAKE_DIRECTORY_EXISTS_OVERWRITE`, deletes the directory and recreates it.
* `\Alexya\FileSystem\Directory::MAKE_DIRECTORY_EXISTS_OPEN`, opens the directory.

@param string $path     Path to the directory.
@param int    $ifExists What to do if directory exists.

@return Directory Directory object.

@throws DirectoryAlreadyExists If $path already exists as a directory.
@throws CouldntCreateDirectory If the directory can't be created.
Makes a directory .