コード例 #1
0
ファイル: Query.php プロジェクト: tunnela/query
 /**
  * Builds a condition array for later use by combining new parameters
  * with the old ones.
  *
  * @param  array $meta Old meta array
  * @param  mixed $where New parameter(s)
  * @return array New parameter array for later use
  */
 protected function _condition($meta = array(), $where = array())
 {
     $args = func_get_args();
     $argCount = count($args);
     if (is_array($where)) {
         $meta = array_merge($meta, $where);
     } else {
         if ($argCount > 3 || $argCount == 3 && preg_match('#\\{:([a-z0-9_-]+)\\}#ui', $where)) {
             $isAssoc = false;
             if (is_array($args[2])) {
                 foreach ($args[2] as $key => $value) {
                     if (is_string($key)) {
                         $isAssoc = true;
                         break;
                     }
                 }
             }
             $meta[] = Expression::params($where, $isAssoc ? $args[2] : array_slice($args, 2));
         } else {
             if ($argCount == 3) {
                 $meta[$where] = $args[2];
             } else {
                 $meta[] = $where;
             }
         }
     }
     return $meta;
 }