original_string: public function length($key, $type = null)
  	{
  		if (is_null($type)) $type = $this->type($key);
  
  		switch ($type)
  		{
  			case 'list':
  				return $this->database->llen($key);
  
  			case 'zset':
  				return $this->database->zcard($key);
  
  			default:
  				throw new UnexpectedValueException("List type '{$type}' not supported.");
  		}
  	}
code: public function length($key, $type = null)
  	{
  		if (is_null($type)) $type = $this->type($key);
  
  		switch ($type)
  		{
  			case 'list':
  				return $this->database->llen($key);
  
  			case 'zset':
  				return $this->database->zcard($key);
  
  			default:
  				throw new UnexpectedValueException("List type '{$type}' not supported.");
  		}
  	}
code_tokens: public function length ( $ key , $ type = null ) { if ( is_null ( $ type ) ) $ type = $ this -> type ( $ key ) ; switch ( $ type ) { case 'list' : return $ this -> database -> llen ( $ key ) ; case 'zset' : return $ this -> database -> zcard ( $ key ) ; default : throw new UnexpectedValueException ( "List type '{$type}' not supported." ) ; } }
docstring: Return the length of a given list or set.
  
  @param  string  $key
  @param  string  $type
  @return integer|\UnexpectedValueException
docstring_tokens: Return the length of a given list or set .