public function set($field, $value = null) { if ($field instanceof AeScalar || $field instanceof AeArray) { $field = $field->getValue(); } // *** Backward compatibility if (is_string($field) && $this->propertyExists($field, 'set')) { return parent::set($field, $value); } $field = (array) $field; if (!is_array($this->_set) && count($field) > 0) { $this->_set = array(); } foreach ($field as $f => $v) { $f = $this->field($f); // *** $v should be bound explicitly $this->_set[] = $f . ' = ' . $v; } return $this; }
/** * Virtual property getter support method * * This method is called every time an {@link isset()} operation is * performed on an undefined or protected property. * * @param string $name property name * * @return bool true if property is not null, false otherwise */ public function __isset($name) { if ($this->propertyExists($name)) { return parent::__isset($name); } return isset($this->_properties[$name]); }
/** * Call stored callback * * Call stored callback. This method accepts an infinite number of * parameters to be passed to the call. * * <b>NOTE:</b> For backwards compatibility with the {@link AeObject::call()} * method, a second parameter is introduced. If the <var>$args</var> parameter * is a string, it is used as the method name, and <var>$ma</var> is used * as an array of parameters for that method * * @see AeObject::call() * * @throws AeCallbackException #400 if no callback value is currently stored * @throws AeCallbackException #400 if arguments type is invalid * * @param array|string $args an array of parameters * @param array $ma * * @return mixed callback call result */ public function call($args = array(), $ma = array()) { $type = AeType::of($args); // *** Backwards compatibility with AeObject::call() if ($type == 'string' && $this->methodExists($name = (string) $args)) { return parent::call($name, $ma); } $callback = $this->getValue(false); if (!$callback) { throw new AeCallbackException('No callback value stored', 400); } if ($type != 'array') { throw new AeCallbackException('Invalid args type: expecting array, ' . $type . ' given', 400); } if (count($args) > 0) { return call_user_func_array($callback, $args); } else { if (count($this->_arguments) > 0) { return call_user_func_array($callback, $this->_arguments); } } return call_user_func($callback); }