00001 <?php 00002 /**************************************************************************** 00003 * Copyright (C) 2008 by Vladlen Y. Koshelev * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU Lesser General Public License as * 00007 * published by the Free Software Foundation; either version 3 of the * 00008 * License, or (at your option) any later version. * 00009 * * 00010 ****************************************************************************/ 00011 00015 final class OqlInExpression extends OqlQueryExpression 00016 { 00017 private $logic = null; 00018 00019 public function __construct( 00020 OqlQueryParameter $left, OqlQueryParameter $right, $logic 00021 ) 00022 { 00023 $this-> 00024 addParameter($left)-> 00025 addParameter($right); 00026 00027 $this->logic = $logic; 00028 } 00029 00033 public function evaluate($values) 00034 { 00035 switch ($this->logic) { 00036 case InExpression::IN: 00037 return Expression::in( 00038 $this->getParameter(0)->evaluate($values), 00039 $this->getParameter(1)->evaluate($values) 00040 ); 00041 00042 case InExpression::NOT_IN: 00043 return Expression::notIn( 00044 $this->getParameter(0)->evaluate($values), 00045 $this->getParameter(1)->evaluate($values) 00046 ); 00047 00048 default: 00049 throw new UnsupportedMethodException( 00050 "'{$this->logic}' doesn't supported yet" 00051 ); 00052 } 00053 } 00054 } 00055 ?>