protected function _condition_constructor($args_num, $params, &$construct_str)
    {
        // params dose not conform to specification
        if ( ! $args_num || $args_num > 3) {
            throw new \InvalidArgumentException("Error number of parameters");
        }
        // argurment mode
        switch ($args_num) {
          // assoc array mode
          case 1:
              if ( ! is_array($params[0])) {
                  throw new \InvalidArgumentException($params[0].' should be Array');
              }
              $construct_str .= '(';
              foreach ($params[0] as $field => $value) {
                  $plh = self::_getPlh();
                  $construct_str .= ' '.self::_wrapRow($field).' = '.$plh.' AND';
                  $this->_bind_params[$plh] = $value;
              }
              // remove last operator
              $construct_str = substr($construct_str, 0, strrpos($construct_str, 'AND'));
              $construct_str .= ')';
              break;
          // ('a', 10) : a = 10 mode or ('a', null) : a is null mode
          case 2:
              if (is_null($params[1])) {
                  $construct_str .= ' '.self::_wrapRow($params[0]).' IS NULL ';
              } else {
                  $plh = self::_getPlh();
                  $construct_str .= ' '.self::_wrapRow($params[0]).' = '.$plh.' ';
                  $this->_bind_params[$plh] = $params[1];
              }
              break;
          // ('a', '>', 10) : a > 10 mode \ ('name', 'like', '%adam%') : name like '%adam%' mode
          case 3:
              if ( ! in_array(strtolower($params[1]), $this->_operators)) {
                  throw new \InvalidArgumentException('Confusing Symbol '.$params[1]);
              }
              $plh = self::_getPlh();
              $construct_str .= ' '.self::_wrapRow($params[0]).' '.$params[1].' '.$plh.' ';
              $this->_bind_params[$plh] = $params[2];
              break;
        }
    }
protected function _condition_constructor($args_num, $params, &$construct_str)
    {
        // params dose not conform to specification
        if ( ! $args_num || $args_num > 3) {
            throw new \InvalidArgumentException("Error number of parameters");
        }
        // argurment mode
        switch ($args_num) {
          // assoc array mode
          case 1:
              if ( ! is_array($params[0])) {
                  throw new \InvalidArgumentException($params[0].' should be Array');
              }
              $construct_str .= '(';
              foreach ($params[0] as $field => $value) {
                  $plh = self::_getPlh();
                  $construct_str .= ' '.self::_wrapRow($field).' = '.$plh.' AND';
                  $this->_bind_params[$plh] = $value;
              }
              // remove last operator
              $construct_str = substr($construct_str, 0, strrpos($construct_str, 'AND'));
              $construct_str .= ')';
              break;
          // ('a', 10) : a = 10 mode or ('a', null) : a is null mode
          case 2:
              if (is_null($params[1])) {
                  $construct_str .= ' '.self::_wrapRow($params[0]).' IS NULL ';
              } else {
                  $plh = self::_getPlh();
                  $construct_str .= ' '.self::_wrapRow($params[0]).' = '.$plh.' ';
                  $this->_bind_params[$plh] = $params[1];
              }
              break;
          // ('a', '>', 10) : a > 10 mode \ ('name', 'like', '%adam%') : name like '%adam%' mode
          case 3:
              if ( ! in_array(strtolower($params[1]), $this->_operators)) {
                  throw new \InvalidArgumentException('Confusing Symbol '.$params[1]);
              }
              $plh = self::_getPlh();
              $construct_str .= ' '.self::_wrapRow($params[0]).' '.$params[1].' '.$plh.' ';
              $this->_bind_params[$plh] = $params[2];
              break;
        }
    }
protected function _condition_constructor ( $ args_num , $ params , & $ construct_str ) { // params dose not conform to specification if ( ! $ args_num || $ args_num > 3 ) { throw new \ InvalidArgumentException ( "Error number of parameters" ) ; } // argurment mode switch ( $ args_num ) { // assoc array mode case 1 : if ( ! is_array ( $ params [ 0 ] ) ) { throw new \ InvalidArgumentException ( $ params [ 0 ] . ' should be Array' ) ; } $ construct_str .= '(' ; foreach ( $ params [ 0 ] as $ field => $ value ) { $ plh = self :: _getPlh ( ) ; $ construct_str .= ' ' . self :: _wrapRow ( $ field ) . ' = ' . $ plh . ' AND' ; $ this -> _bind_params [ $ plh ] = $ value ; } // remove last operator $ construct_str = substr ( $ construct_str , 0 , strrpos ( $ construct_str , 'AND' ) ) ; $ construct_str .= ')' ; break ; // ('a', 10) : a = 10 mode or ('a', null) : a is null mode case 2 : if ( is_null ( $ params [ 1 ] ) ) { $ construct_str .= ' ' . self :: _wrapRow ( $ params [ 0 ] ) . ' IS NULL ' ; } else { $ plh = self :: _getPlh ( ) ; $ construct_str .= ' ' . self :: _wrapRow ( $ params [ 0 ] ) . ' = ' . $ plh . ' ' ; $ this -> _bind_params [ $ plh ] = $ params [ 1 ] ; } break ; // ('a', '>', 10) : a > 10 mode \ ('name', 'like', '%adam%') : name like '%adam%' mode case 3 : if ( ! in_array ( strtolower ( $ params [ 1 ] ) , $ this -> _operators ) ) { throw new \ InvalidArgumentException ( 'Confusing Symbol ' . $ params [ 1 ] ) ; } $ plh = self :: _getPlh ( ) ; $ construct_str .= ' ' . self :: _wrapRow ( $ params [ 0 ] ) . ' ' . $ params [ 1 ] . ' ' . $ plh . ' ' ; $ this -> _bind_params [ $ plh ] = $ params [ 2 ] ; break ; } }
parse argurment, create build attr, store bind param

@param  int $args_num
@param  array $params
@param  string &$construct_str
@return  void
@throws  \InvalidArgumentException
parse argurment create build attr store bind param