public function httpCopy(RequestInterface $request, ResponseInterface $response)
    {
        $path = $request->getPath();

        $copyInfo = $this->server->getCopyAndMoveInfo($request);

        if (!$this->server->emit('beforeBind', [$copyInfo['destination']])) {
            return false;
        }
        if ($copyInfo['destinationExists']) {
            if (!$this->server->emit('beforeUnbind', [$copyInfo['destination']])) {
                return false;
            }
            $this->server->tree->delete($copyInfo['destination']);
        }

        $this->server->tree->copy($path, $copyInfo['destination']);
        $this->server->emit('afterBind', [$copyInfo['destination']]);

        // If a resource was overwritten we should send a 204, otherwise a 201
        $response->setHeader('Content-Length', '0');
        $response->setStatus($copyInfo['destinationExists'] ? 204 : 201);

        // Sending back false will interrupt the event chain and tell the server
        // we've handled this method.
        return false;
    }
public function httpCopy(RequestInterface $request, ResponseInterface $response)
    {
        $path = $request->getPath();

        $copyInfo = $this->server->getCopyAndMoveInfo($request);

        if (!$this->server->emit('beforeBind', [$copyInfo['destination']])) {
            return false;
        }
        if ($copyInfo['destinationExists']) {
            if (!$this->server->emit('beforeUnbind', [$copyInfo['destination']])) {
                return false;
            }
            $this->server->tree->delete($copyInfo['destination']);
        }

        $this->server->tree->copy($path, $copyInfo['destination']);
        $this->server->emit('afterBind', [$copyInfo['destination']]);

        // If a resource was overwritten we should send a 204, otherwise a 201
        $response->setHeader('Content-Length', '0');
        $response->setStatus($copyInfo['destinationExists'] ? 204 : 201);

        // Sending back false will interrupt the event chain and tell the server
        // we've handled this method.
        return false;
    }
public function httpCopy ( RequestInterface $ request , ResponseInterface $ response ) { $ path = $ request -> getPath ( ) ; $ copyInfo = $ this -> server -> getCopyAndMoveInfo ( $ request ) ; if ( ! $ this -> server -> emit ( 'beforeBind' , [ $ copyInfo [ 'destination' ] ] ) ) { return false ; } if ( $ copyInfo [ 'destinationExists' ] ) { if ( ! $ this -> server -> emit ( 'beforeUnbind' , [ $ copyInfo [ 'destination' ] ] ) ) { return false ; } $ this -> server -> tree -> delete ( $ copyInfo [ 'destination' ] ) ; } $ this -> server -> tree -> copy ( $ path , $ copyInfo [ 'destination' ] ) ; $ this -> server -> emit ( 'afterBind' , [ $ copyInfo [ 'destination' ] ] ) ; // If a resource was overwritten we should send a 204, otherwise a 201 $ response -> setHeader ( 'Content-Length' , '0' ) ; $ response -> setStatus ( $ copyInfo [ 'destinationExists' ] ? 204 : 201 ) ; // Sending back false will interrupt the event chain and tell the server // we've handled this method. return false ; }
WebDAV HTTP COPY method.

This method copies one uri to a different uri, and works much like the MOVE request
A lot of the actual request processing is done in getCopyMoveInfo

@param RequestInterface  $request
@param ResponseInterface $response

@return bool
WebDAV HTTP COPY method .