@@ -26,11 +26,11 @@ class OrderKeyword extends Component
2626{
2727
2828 /**
29- * The field that is used for ordering.
29+ * The expression that is used for ordering.
3030 *
3131 * @var Expression
3232 */
33- public $ field ;
33+ public $ expr ;
3434
3535 /**
3636 * The order type.
@@ -42,12 +42,12 @@ class OrderKeyword extends Component
4242 /**
4343 * Constructor.
4444 *
45- * @param Expression $field The field that we are sorting by.
45+ * @param Expression $expr The expression that we are sorting by.
4646 * @param string $type The sorting type.
4747 */
48- public function __construct ($ field = null , $ type = 'ASC ' )
48+ public function __construct ($ expr = null , $ type = 'ASC ' )
4949 {
50- $ this ->field = $ field ;
50+ $ this ->expr = $ expr ;
5151 $ this ->type = $ type ;
5252 }
5353
@@ -69,7 +69,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
6969 *
7070 * Below are the states of the parser.
7171 *
72- * 0 ----------------------[ field ]--- -------------------> 1
72+ * 0 --------------------[ expression ] -------------------> 1
7373 *
7474 * 1 ------------------------[ , ]------------------------> 0
7575 * 1 -------------------[ ASC / DESC ]--------------------> 1
@@ -96,13 +96,13 @@ public static function parse(Parser $parser, TokensList $list, array $options =
9696 }
9797
9898 if ($ state === 0 ) {
99- $ expr ->field = Expression::parse ($ parser , $ list );
99+ $ expr ->expr = Expression::parse ($ parser , $ list );
100100 $ state = 1 ;
101101 } elseif ($ state === 1 ) {
102102 if (($ token ->type === Token::TYPE_KEYWORD ) && (($ token ->value === 'ASC ' ) || ($ token ->value === 'DESC ' ))) {
103103 $ expr ->type = $ token ->value ;
104104 } elseif (($ token ->type === Token::TYPE_OPERATOR ) && ($ token ->value === ', ' )) {
105- if (!empty ($ expr ->field )) {
105+ if (!empty ($ expr ->expr )) {
106106 $ ret [] = $ expr ;
107107 }
108108 $ expr = new OrderKeyword ();
@@ -115,7 +115,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
115115 }
116116
117117 // Last iteration was not processed.
118- if (!empty ($ expr ->field )) {
118+ if (!empty ($ expr ->expr )) {
119119 $ ret [] = $ expr ;
120120 }
121121
@@ -137,7 +137,7 @@ public static function build($component)
137137 }
138138 return implode (", " , $ ret );
139139 } else {
140- return Expression::build ($ component ->field ) . ' ' . $ component ->type ;
140+ return Expression::build ($ component ->expr ) . ' ' . $ component ->type ;
141141 }
142142 }
143143}
0 commit comments