Bolt\Storage\Query\ContentQueryParser::getDirective PHP Method

getDirective() public method

Returns a directive from the parsed list.
public getDirective ( string $key ) : string
$key string
return string
    public function getDirective($key)
    {
        return $this->directives[$key];
    }

Usage Example

Example #1
0
 public function testDirectiveParsing()
 {
     $app = $this->getApp();
     $qb = new ContentQueryParser($app['storage'], $app['query.select']);
     $qb->setQuery('entries');
     $qb->setParameters(['order' => '-datepublish', 'id' => '!1']);
     $qb->parse();
     $this->assertEquals(['entries'], $qb->getContentTypes());
     $this->assertEquals('select', $qb->getOperation());
     $this->assertEquals('-datepublish', $qb->getDirective('order'));
     $this->assertEquals('!1', $qb->getParameter('id'));
     $this->assertEquals(1, count($qb->getParameters()));
 }