public static function copy(string $path, string $to, string $type, bool $symlink = false):int
    {
        try {
            if ($symlink != false) {
                @symlink($path, $to);
            } elseif ($symlink == false && $type == "directory") {
                self::recursiveCopy($path, $to);
            } elseif ($symlink == false && $type == "file") {
                copy($path, $to);
            } else {
                throw new \Exception("Server Error on Copy: Element type is not regonized");
            }
        } catch (\Exception $exception) {
            throw new \Exception("Server Error : Cannot move $path to $to => ".$exception);
        }

        return (1);
    }
public static function copy(string $path, string $to, string $type, bool $symlink = false):int
    {
        try {
            if ($symlink != false) {
                @symlink($path, $to);
            } elseif ($symlink == false && $type == "directory") {
                self::recursiveCopy($path, $to);
            } elseif ($symlink == false && $type == "file") {
                copy($path, $to);
            } else {
                throw new \Exception("Server Error on Copy: Element type is not regonized");
            }
        } catch (\Exception $exception) {
            throw new \Exception("Server Error : Cannot move $path to $to => ".$exception);
        }

        return (1);
    }
public static function copy ( string $ path , string $ to , string $ type , bool $ symlink = false ) : int { try { if ( $ symlink != false ) { @ symlink ( $ path , $ to ) ; } elseif ( $ symlink == false && $ type == "directory" ) { self :: recursiveCopy ( $ path , $ to ) ; } elseif ( $ symlink == false && $ type == "file" ) { copy ( $ path , $ to ) ; } else { throw new \ Exception ( "Server Error on Copy: Element type is not regonized" ) ; } } catch ( \ Exception $ exception ) { throw new \ Exception ( "Server Error : Cannot move $path to $to => " . $ exception ) ; } return ( 1 ) ; }
Copy an element on the server
@param string $path Element Path
@param string $to Move to
@param string $type Element type
@param bool $symlink Is symlink
@return int Result
@throws \Exception Generate Error
Copy an element on the server