Exemple #1
0
 /**
  * Equals
  *
  * @access public
  * @param \Skeleton\Pager\Sql\Condition $condition
  * @return boolean $equals
  */
 public function equals(\Skeleton\Pager\Sql\Condition $condition)
 {
     if ($this->get_local_field() != $condition->get_local_field()) {
         return false;
     }
     if ($this->get_comparison() == '=' and $condition->get_comparison() == 'IN') {
         foreach ($condition->get_value()[0] as $value) {
             if ($this->get_value() == $value) {
                 return true;
             }
         }
     }
     if ($condition->get_comparison() == '=' and $this->get_comparison() == 'IN') {
         foreach ($this->get_value()[0] as $value) {
             if ($condition->get_value() == $value) {
                 return true;
             }
         }
     }
     if ($this->get_comparison() != $condition->get_comparison()) {
         return false;
     }
     if (!is_array($this->get_value()) and !is_array($condition->get_value())) {
         if ($this->get_value() != $condition->get_value()) {
             return false;
         }
     } elseif (is_array($this->get_value()) and is_array($condition->get_value())) {
         $diff = array_diff($this->get_value(), $condition->get_value());
         if (count($diff) > 0) {
             return false;
         }
     } else {
         return false;
     }
     return true;
 }