private function checkKeyContains($key, $item, $itemValue = null)
    {
        $result = null;

        if (!is_scalar($item)) {
            throw new ModuleException(
                $this,
                "All arguments of [dont]seeRedisKeyContains() must be scalars"
            );
        }

        switch ($this->driver->type($key)) {
            case 'string':
                $reply = $this->driver->get($key);
                $result = strpos($reply, $item) !== false;
                break;

            case 'list':
                $reply = $this->driver->lrange($key, 0, -1);
                $result = in_array($item, $reply);
                break;

            case 'set':
                $result = $this->driver->sismember($key, $item);
                break;

            case 'zset':
                $reply = $this->driver->zscore($key, $item);

                if (is_null($reply)) {
                    $result = false;
                } elseif (!is_null($itemValue)) {
                    $result = (float) $reply === (float) $itemValue;
                } else {
                    $result = true;
                }
                break;

            case 'hash':
                $reply = $this->driver->hget($key, $item);

                $result = is_null($itemValue)
                    ? !is_null($reply)
                    : (string) $reply === (string) $itemValue;
                break;

            case 'none':
                throw new ModuleException(
                    $this,
                    "Key \"$key\" does not exist"
                );
                break;
        }

        return $result;
    }
private function checkKeyContains($key, $item, $itemValue = null)
    {
        $result = null;

        if (!is_scalar($item)) {
            throw new ModuleException(
                $this,
                "All arguments of [dont]seeRedisKeyContains() must be scalars"
            );
        }

        switch ($this->driver->type($key)) {
            case 'string':
                $reply = $this->driver->get($key);
                $result = strpos($reply, $item) !== false;
                break;

            case 'list':
                $reply = $this->driver->lrange($key, 0, -1);
                $result = in_array($item, $reply);
                break;

            case 'set':
                $result = $this->driver->sismember($key, $item);
                break;

            case 'zset':
                $reply = $this->driver->zscore($key, $item);

                if (is_null($reply)) {
                    $result = false;
                } elseif (!is_null($itemValue)) {
                    $result = (float) $reply === (float) $itemValue;
                } else {
                    $result = true;
                }
                break;

            case 'hash':
                $reply = $this->driver->hget($key, $item);

                $result = is_null($itemValue)
                    ? !is_null($reply)
                    : (string) $reply === (string) $itemValue;
                break;

            case 'none':
                throw new ModuleException(
                    $this,
                    "Key \"$key\" does not exist"
                );
                break;
        }

        return $result;
    }
private function checkKeyContains ( $ key , $ item , $ itemValue = null ) { $ result = null ; if ( ! is_scalar ( $ item ) ) { throw new ModuleException ( $ this , "All arguments of [dont]seeRedisKeyContains() must be scalars" ) ; } switch ( $ this -> driver -> type ( $ key ) ) { case 'string' : $ reply = $ this -> driver -> get ( $ key ) ; $ result = strpos ( $ reply , $ item ) !== false ; break ; case 'list' : $ reply = $ this -> driver -> lrange ( $ key , 0 , - 1 ) ; $ result = in_array ( $ item , $ reply ) ; break ; case 'set' : $ result = $ this -> driver -> sismember ( $ key , $ item ) ; break ; case 'zset' : $ reply = $ this -> driver -> zscore ( $ key , $ item ) ; if ( is_null ( $ reply ) ) { $ result = false ; } elseif ( ! is_null ( $ itemValue ) ) { $ result = ( float ) $ reply === ( float ) $ itemValue ; } else { $ result = true ; } break ; case 'hash' : $ reply = $ this -> driver -> hget ( $ key , $ item ) ; $ result = is_null ( $ itemValue ) ? ! is_null ( $ reply ) : ( string ) $ reply === ( string ) $ itemValue ; break ; case 'none' : throw new ModuleException ( $ this , "Key \"$key\" does not exist" ) ; break ; } return $ result ; }
Checks whether a key contains a given item

@param string $key       The key
@param mixed  $item      The item
@param null   $itemValue Optional and only used for zsets and hashes. If
specified, the method will also check that the $item has this value/score

@return bool

@throws ModuleException
Checks whether a key contains a given item