src/GameOfLife/Utils/FileSystem/FileSystemWriter.php
/**
     * Deletes a directory.
     *
     * @param string $_directoryPath The directory path
     * @param bool $_deleteWhenNotEmpty If set to true all files inside the directory will be deleted
     *
     * @throws \Exception The exception when the target directory does not exist or is not empty and shall not be deleted in that case
     */
Deletes a directory.
@param string $_directoryPath The directory path
@param bool $_deleteWhenNotEmpty If set to true all files inside the directory will be deleted

@throws \Exception The exception when the target directory does not exist or is not empty and shall not be deleted in that case
Deletes a directory . @param string $_directoryPath The directory path @param bool $_deleteWhenNotEmpty If set to true all files inside the directory will be deleted @throws \ Exception The exception when the target directory does not exist or is not empty and shall not be deleted in that case
public function deleteDirectory(string $_directoryPath, bool $_deleteWhenNotEmpty = false)
    {
        $directoryPath = $this->convertSlashes($_directoryPath);
        if (! file_exists($directoryPath)) throw new \Exception("The directory \"" . $directoryPath . "\" does not exist.");
        $files = $this->fileSystemReader->getFileList($directoryPath . "/*");
        if (count($files) !== 0)
        {
            if (! $_deleteWhenNotEmpty) throw new \Exception("The directory \"" . $_directoryPath . "\" is not empty");
            else $this->deleteFilesInDirectory($directoryPath, true);
        }
        rmdir($directoryPath);
        if (file_exists($directoryPath))
        {
            throw new \Exception("Unknown error while deleting the directory \"" . $directoryPath . "\".");
        }
    }
public function deleteDirectory ( string $ _directoryPath , bool $ _deleteWhenNotEmpty = false ) { $ directoryPath = $ this -> convertSlashes ( $ _directoryPath ) ; if ( ! file_exists ( $ directoryPath ) ) throw new \ Exception ( " The directory  \" " . $ directoryPath . " \"  does not exist. " ) ; $ files = $ this -> fileSystemReader -> getFileList ( $ directoryPath . " /* " ) ; if ( count ( $ files ) !== 0 ) { if ( ! $ _deleteWhenNotEmpty ) throw new \ Exception ( " The directory  \" " . $ _directoryPath . " \"  is not empty " ) ; else $ this -> deleteFilesInDirectory ( $ directoryPath , true ) ; } rmdir ( $ directoryPath ) ; if ( file_exists ( $ directoryPath ) ) { throw new \ Exception ( " Unknown error while deleting the directory  \" " . $ directoryPath . " \" . " ) ; } }
Deletes a directory.
Deletes a directory .