src/lib/Herrera/Box/Extract.php
public static function purge($path)
    {
        if (is_dir($path)) {
            foreach (scandir($path) as $item) {
                if (('.' === $item) || ('..' === $item)) {
                    continue;
                }

                self::purge($path . DIRECTORY_SEPARATOR . $item);
            }

            if (!rmdir($path)) {
                throw new RuntimeException(
                    sprintf(
                        'The directory "%s" could not be deleted.',
                        $path
                    )
                );
            }
        } else {
            if (!unlink($path)) {
                throw new RuntimeException(
                    sprintf(
                        'The file "%s" could not be deleted.',
                        $path
                    )
                );
            }
        }
    }
public static function purge($path)
    {
        if (is_dir($path)) {
            foreach (scandir($path) as $item) {
                if (('.' === $item) || ('..' === $item)) {
                    continue;
                }

                self::purge($path . DIRECTORY_SEPARATOR . $item);
            }

            if (!rmdir($path)) {
                throw new RuntimeException(
                    sprintf(
                        'The directory "%s" could not be deleted.',
                        $path
                    )
                );
            }
        } else {
            if (!unlink($path)) {
                throw new RuntimeException(
                    sprintf(
                        'The file "%s" could not be deleted.',
                        $path
                    )
                );
            }
        }
    }
public static function purge ( $ path ) { if ( is_dir ( $ path ) ) { foreach ( scandir ( $ path ) as $ item ) { if ( ( '.' === $ item ) || ( '..' === $ item ) ) { continue ; } self :: purge ( $ path . DIRECTORY_SEPARATOR . $ item ) ; } if ( ! rmdir ( $ path ) ) { throw new RuntimeException ( sprintf ( 'The directory "%s" could not be deleted.' , $ path ) ) ; } } else { if ( ! unlink ( $ path ) ) { throw new RuntimeException ( sprintf ( 'The file "%s" could not be deleted.' , $ path ) ) ; } } }
Recursively deletes the directory or file path.

@param string $path The path to delete.

@throws RuntimeException If the path could not be deleted.
Recursively deletes the directory or file path .