コード例 #1
0
ファイル: Options.php プロジェクト: Rodrifer/candyclub
 /**
  * @see parent
  *
  * @param string $name
  * @param array $args
  * @return mixed
  */
 public function __call($name, $args)
 {
     $result = parent::__call($name, $args);
     if (preg_match('/(?:SoapClient|Observer|Retryer|Error)$/', $name)) {
         $this->_init();
     }
     return $result;
 }
コード例 #2
0
ファイル: Read.php プロジェクト: Rodrifer/candyclub
 /**
  * @see parent
  *
  * @param string $name
  * @param array $arguments
  * @return mixed
  */
 public function __call($name, $arguments)
 {
     list($prefix, $camelized) = $this->_camelizedValue($name);
     if (array_key_exists($camelized, $this->_requestFields)) {
         return parent::__call($name, $arguments);
     } else {
         $filter = $this->_data['filter'];
         $return = $filter->__call($name, $arguments);
         if ($return == $filter) {
             return $this;
         } else {
             return $return;
         }
     }
 }
コード例 #3
0
ファイル: Write.php プロジェクト: Rodrifer/candyclub
 /**
  * @see parent
  * @param string $name
  * @param array $arguments
  * @return mixed
  */
 public function __call($name, $arguments)
 {
     if (in_array($name, $this->_acceptablePrefixes)) {
         return $this->push($arguments);
     } else {
         if (preg_match("/^isFullOf{$this->_operation->getPluralizedType()}/", $name)) {
             $camelized = $this->_resolvedKey;
             if (!array_key_exists($camelized, $this->_data)) {
                 return false;
             }
             return count($this->_data[$camelized]) >= $this->_limit;
         } else {
             try {
                 parent::__call($name, $arguments);
             } catch (BadMethodCallException $bme) {
                 throw new BadMethodCallException("For {$this->_method}, supported chains are: " . implode(', ', $this->_acceptablePrefixes), 0, $bme);
             }
         }
     }
 }
コード例 #4
0
ファイル: Filter.php プロジェクト: Rodrifer/candyclub
 /**
  * Magic invocation is used in field names where filter operators
  * are applicable.
  *
  * @param string $name
  * @param array $arguments
  * @return Bronto_Api_Read
  * @throws LogicException
  */
 public function __call($name, $arguments)
 {
     switch ($name) {
         case 'equalTo':
         case 'notEqualTo':
         case 'startsWith':
         case 'endsWith':
         case 'doesNotStartWith':
         case 'doesNotEndWith':
         case 'greaterThan':
         case 'lessThan':
         case 'contains':
         case 'doesNotContain':
         case 'sameYear':
         case 'notSameYear':
         case 'sameDay':
         case 'notSameDay':
         case 'before':
         case 'after':
         case 'beforeOrSameDay':
         case 'afterOrSameDay':
             $this->_protectStatement($name);
             if (!array_key_exists($this->_currentField, $this->_data)) {
                 $this->_data[$this->_currentField] = array();
             }
             array_push($this->_data[$this->_currentField], array('operator' => ucfirst($name), 'value' => $arguments[0]));
             return $this->close();
         case 'in':
             $this->_protectStatement($name);
             $value = is_array($arguments[0]) ? $arguments[0] : $arguments;
             return $this->_set('type', 'OR')->_set($this->_currentField, $value)->close();
         case 'is':
             $this->_protectStatement($name);
             if (is_array($arguments[0])) {
                 $value = $arguments[0];
             } else {
                 if (count($arguments) > 1) {
                     $value = $arguments;
                 } else {
                     $value = array($arguments[0]);
                 }
             }
             return $this->_set($this->_currentField, $value)->close();
         default:
             return parent::__call($name, $arguments);
     }
 }