Horde_Kolab_Storage_List_Tools::getQuery PHP Method

getQuery() public method

Return a query object.
public getQuery ( string $type = null )
$type string The query type that should be returned.
    public function getQuery($type = null)
    {
        if ($type === null) {
            $type = self::QUERY_BASE;
        }
        if (!in_array($type, self::$_supported_queries)) {
            throw new Horde_Kolab_Storage_List_Exception(sprintf("Queries of type '%s' are not supported!", $type));
        }
        if (!isset($this->_queries[$type])) {
            throw new Horde_Kolab_Storage_List_Exception(sprintf("No query of type '%s' registered!", $type));
        }
        return $this->_queries[$type];
    }

Usage Example

Esempio n. 1
0
 public function testCachedShareQuery()
 {
     $tools = new Horde_Kolab_Storage_List_Tools($this->_getDriver(), $this->getMock('Horde_Kolab_Storage_Cache', array(), array(), '', false, false), $this->getMock('Horde_Log_Logger'), array('queries' => array('list' => array(Horde_Kolab_Storage_List_Tools::QUERY_SHARE => array('cache' => true)))));
     $this->assertInstanceOf('Horde_Kolab_Storage_List_Query_Share_Cache', $tools->getQuery(Horde_Kolab_Storage_List_Tools::QUERY_SHARE));
 }