protected function is($key)
    {
        switch ($key = strtolower($key)) {

            case 'ajax':
                if (!isset($this->isCache['ajax'])) {
                    return $this->isCache['ajax'] = $this->getService('Request')->isXmlHttpRequest();
                }

                return $this->isCache['ajax'];

            case 'put':
            case 'delete':
            case 'post':
            case 'patch':
                if (!isset($this->isCache['requestMethod'][$key])) {
                    $this->isCache['requestMethod'][$key] = $this->getService('Request')->getMethod() === strtoupper($key);
                }

                return $this->isCache['requestMethod'][$key];

            case 'ssl':
            case 'https':
            case 'secure':
                if (!isset($this->isCache['secure'])) {
                    $this->isCache['secure'] = $this->getService('Request')->isSecure();
                }

                return $this->isCache['secure'];

            default:
                throw new \InvalidArgumentException("Invalid 'is' key supplied: {$key}");

        }
    }
protected function is($key)
    {
        switch ($key = strtolower($key)) {

            case 'ajax':
                if (!isset($this->isCache['ajax'])) {
                    return $this->isCache['ajax'] = $this->getService('Request')->isXmlHttpRequest();
                }

                return $this->isCache['ajax'];

            case 'put':
            case 'delete':
            case 'post':
            case 'patch':
                if (!isset($this->isCache['requestMethod'][$key])) {
                    $this->isCache['requestMethod'][$key] = $this->getService('Request')->getMethod() === strtoupper($key);
                }

                return $this->isCache['requestMethod'][$key];

            case 'ssl':
            case 'https':
            case 'secure':
                if (!isset($this->isCache['secure'])) {
                    $this->isCache['secure'] = $this->getService('Request')->isSecure();
                }

                return $this->isCache['secure'];

            default:
                throw new \InvalidArgumentException("Invalid 'is' key supplied: {$key}");

        }
    }
protected function is ( $ key ) { switch ( $ key = strtolower ( $ key ) ) { case 'ajax' : if ( ! isset ( $ this -> isCache [ 'ajax' ] ) ) { return $ this -> isCache [ 'ajax' ] = $ this -> getService ( 'Request' ) -> isXmlHttpRequest ( ) ; } return $ this -> isCache [ 'ajax' ] ; case 'put' : case 'delete' : case 'post' : case 'patch' : if ( ! isset ( $ this -> isCache [ 'requestMethod' ] [ $ key ] ) ) { $ this -> isCache [ 'requestMethod' ] [ $ key ] = $ this -> getService ( 'Request' ) -> getMethod ( ) === strtoupper ( $ key ) ; } return $ this -> isCache [ 'requestMethod' ] [ $ key ] ; case 'ssl' : case 'https' : case 'secure' : if ( ! isset ( $ this -> isCache [ 'secure' ] ) ) { $ this -> isCache [ 'secure' ] = $ this -> getService ( 'Request' ) -> isSecure ( ) ; } return $ this -> isCache [ 'secure' ] ; default : throw new \ InvalidArgumentException ( "Invalid 'is' key supplied: {$key}" ) ; } }
Check if a condition 'is' true.

@param string $key

@throws InvalidArgumentException

@return bool
Check if a condition is true .