query() public method

Returns whether the server supports the given capability.
public query ( string $capability, string $parameter = null ) : boolean
$capability string The capability string to query.
$parameter string If set, require the parameter to exist.
return boolean True if the capability (and parameter) exist.
Beispiel #1
0
 public function testRemoval()
 {
     $c = new Horde_Imap_Client_Data_Capability();
     $c->add('FOO');
     $this->assertTrue($c->query('FOO'));
     $c->remove('FOO');
     $this->assertFalse($c->query('FOO'));
     $c->add('BAR', array('A', 'B', 'C'));
     $c->remove('BAR', array('A', 'C'));
     $this->assertTrue($c->query('BAR'));
     $this->assertFalse($c->query('BAR', 'A'));
     $this->assertTrue($c->query('BAR', 'B'));
     $this->assertFalse($c->query('BAR', 'C'));
     $c->remove('BAR', 'b');
     $this->assertFalse($c->query('BAR'));
     $this->assertFalse($c->query('BAR', 'A'));
     $this->assertFalse($c->query('BAR', 'B'));
     $this->assertFalse($c->query('BAR', 'C'));
 }
Beispiel #2
0
 /**
  */
 public function query($capability, $parameter = null)
 {
     if (parent::query($capability, $parameter)) {
         return true;
     }
     switch (Horde_String::upper($capability)) {
         case 'CONDSTORE':
         case 'ENABLE':
             /* RFC 7162 [3.2.3] - QRESYNC implies CONDSTORE and ENABLE. */
             return is_null($parameter) && $this->query('QRESYNC');
         case 'UTF8':
             /* RFC 6855 [3] - UTF8=ONLY implies UTF8=ACCEPT. */
             return Horde_String::upper($parameter) === 'ACCEPT' && $this->query('UTF8', 'ONLY');
     }
     return false;
 }