phpseclib\Net\SFTP::_close_handle PHP Method

_close_handle() public method

Close handle
public _close_handle ( string $handle ) : boolean
$handle string
return boolean
    function _close_handle($handle)
    {
        if (!$this->_send_sftp_packet(NET_SFTP_CLOSE, pack('Na*', strlen($handle), $handle))) {
            return false;
        }
        // "The client MUST release all resources associated with the handle regardless of the status."
        //  -- http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.1.3
        $response = $this->_get_sftp_packet();
        if ($this->packet_type != NET_SFTP_STATUS) {
            throw new \UnexpectedValueException('Expected SSH_FXP_STATUS');
        }
        if (strlen($response) < 4) {
            return false;
        }
        extract(unpack('Nstatus', Strings::shift($response, 4)));
        if ($status != NET_SFTP_STATUS_OK) {
            $this->_logError($response, $status);
            return false;
        }
        return true;
    }