phpseclib\Net\SFTP::_stat PHP Method

_stat() public method

Determines information without calling \phpseclib\Net\SFTP::_realpath(). The second parameter can be either NET_SFTP_STAT or NET_SFTP_LSTAT.
public _stat ( string $filename, integer $type ) : mixed
$filename string
$type integer
return mixed
    function _stat($filename, $type)
    {
        // SFTPv4+ adds an additional 32-bit integer field - flags - to the following:
        $packet = pack('Na*', strlen($filename), $filename);
        if (!$this->_send_sftp_packet($type, $packet)) {
            return false;
        }
        $response = $this->_get_sftp_packet();
        switch ($this->packet_type) {
            case NET_SFTP_ATTRS:
                return $this->_parseAttributes($response);
            case NET_SFTP_STATUS:
                $this->_logError($response);
                return false;
        }
        throw new \UnexpectedValueException('Expected SSH_FXP_ATTRS or SSH_FXP_STATUS');
    }