Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 final class OqlOrderByParser extends OqlParser
00013 {
00017 public static function create()
00018 {
00019 return new self;
00020 }
00021
00025 protected function makeOqlObject()
00026 {
00027 return OqlOrderByClause::create();
00028 }
00029
00030 protected function handleState()
00031 {
00032 if ($this->state == self::INITIAL_STATE) {
00033 $list = $this->getCommaSeparatedList(
00034 array($this, 'getArgumentExpression'),
00035 "expecting expression in 'order by'"
00036 );
00037
00038 foreach ($list as $argument)
00039 $this->oqlObject->add($argument);
00040 }
00041
00042 return self::FINAL_STATE;
00043 }
00044
00048 protected function getArgumentExpression()
00049 {
00050 $expression = $this->getLogicExpression();
00051
00052 $token = $this->tokenizer->peek();
00053 if ($this->checkKeyword($token, array('asc', 'desc'))) {
00054 $direction = ($token->getValue() == 'asc');
00055 $this->tokenizer->next();
00056
00057 } else
00058 $direction = null;
00059
00060 return new OqlOrderByExpression($expression, $direction);
00061 }
00062 }
00063 ?>