public static function delete(string $path, string $type):int
    {
        try {
            switch ($type) {
                case "directory":
                    if (is_link($path)) {
                        unlink($path);
                    } elseif (is_dir($path)) {
                        try {
                            self::recursiveRmdir($path);
                        } catch (\Exception $e) {
                            throw new \Exception("Server Manager delete error =>" . $e->getMessage());
                        }
                    }
                    break;
                case "file":
                    if (is_link($path)) {
                        unlink($path);
                    } elseif (file($path)) {
                        try {
                            unlink($path);
                        } catch (\Exception $e) {
                            throw new \Exception("Server Manager delete error =>" . $e->getMessage());
                        }
                    }
                    break;
            }
        } catch (\Exception $exception) {
            throw new \Exception("Server Error : Cannot delete $type element => ".$exception);
        }

        return (1);
    }
public static function delete(string $path, string $type):int
    {
        try {
            switch ($type) {
                case "directory":
                    if (is_link($path)) {
                        unlink($path);
                    } elseif (is_dir($path)) {
                        try {
                            self::recursiveRmdir($path);
                        } catch (\Exception $e) {
                            throw new \Exception("Server Manager delete error =>" . $e->getMessage());
                        }
                    }
                    break;
                case "file":
                    if (is_link($path)) {
                        unlink($path);
                    } elseif (file($path)) {
                        try {
                            unlink($path);
                        } catch (\Exception $e) {
                            throw new \Exception("Server Manager delete error =>" . $e->getMessage());
                        }
                    }
                    break;
            }
        } catch (\Exception $exception) {
            throw new \Exception("Server Error : Cannot delete $type element => ".$exception);
        }

        return (1);
    }
public static function delete ( string $ path , string $ type ) : int { try { switch ( $ type ) { case "directory" : if ( is_link ( $ path ) ) { unlink ( $ path ) ; } elseif ( is_dir ( $ path ) ) { try { self :: recursiveRmdir ( $ path ) ; } catch ( \ Exception $ e ) { throw new \ Exception ( "Server Manager delete error =>" . $ e -> getMessage ( ) ) ; } } break ; case "file" : if ( is_link ( $ path ) ) { unlink ( $ path ) ; } elseif ( file ( $ path ) ) { try { unlink ( $ path ) ; } catch ( \ Exception $ e ) { throw new \ Exception ( "Server Manager delete error =>" . $ e -> getMessage ( ) ) ; } } break ; } } catch ( \ Exception $ exception ) { throw new \ Exception ( "Server Error : Cannot delete $type element => " . $ exception ) ; } return ( 1 ) ; }
Delete an element on the server
@param string $path Element Path
@param string $type Element type
@return int Result
@throws \Exception Generate Error
Delete an element on the server