This method will check if any attached behavior has
the named method and will execute it if available.
Do not call this method directly as it is a PHP magic method that
will be implicitly called when an unknown method is being invoked.
public function __call($name, $parameters) { if (method_exists($this->_api, $name)) { return call_user_func_array(array($this->_api, $name), $parameters); } return parent::__call($name, $parameters); }
/** * @param string $name * @param array $params * @return mixed|object */ public function __call($name, $params) { $query = strpos($name, 'Query'); $static = strpos($name, 'static'); if ($static === 0) { $property = mb_substr($name, 6); } else { if ($query !== false) { $property = mb_substr($name, 6, -5); } else { $property = mb_substr($name, 6); } } $property = lcfirst($property) . 'Class'; if ($static === 0) { $method = ArrayHelper::remove($params, '0', 'className'); return forward_static_call_array([$this->{$property}, $method], $params); } if ($query) { $method = ArrayHelper::remove($params, '0', 'find'); return forward_static_call_array([$this->{$property}, $method], $params); } if (isset($this->{$property})) { $config = []; if (isset($params[0]) && is_array($params[0])) { $config = $params[0]; } $config['class'] = $this->{$property}; return Yii::createObject($config); } return parent::__call($name, $params); }
public function __call($name, $params) { if (!method_exists($this->getClient(), $name)) { return parent::__call($name, $params); } return call_user_func_array(array($this->getClient(), $name), $params); }
public function __call($name, $params) { if (method_exists($this->_client, $name)) { return call_user_func_array([$this->_client, $name], $params); } return parent::__call($name, $params); }
public function __call($method, $params) { $sdk = $this->getSdk(); if (is_callable([$sdk, $method])) { return call_user_func_array(array($sdk, $method), $params); } return parent::__call($method, $params); }
/** * Use magic PHP function __call to route function calls to the adLDAP class. * Look into the adLDAP class for possible functions. * * @param string $methodName Method name from adLDAP class * @param array $methodParams Parameters pass to method * @return mixed */ public function __call($methodName, $methodParams) { if (method_exists($this->adLdapClass, $methodName)) { return call_user_func_array(array($this->adLdapClass, $methodName), $methodParams); } else { return parent::__call($methodName, $methodParams); } }
public function __call($name, $params) { $ucFunctionName = 'uc_' . $name; if (function_exists($ucFunctionName)) { return call_user_func_array($ucFunctionName, $params); } return parent::__call($name, $params); }
public function __call($method, $params) { $client = $this->getAws(); if (method_exists($client, $method)) { return call_user_func_array(array($client, $method), $params); } return parent::__call($method, $params); }
public function __call($name, $params) { if (method_exists($this->getService(), $name)) { call_user_func_array([$this->getService(), $name], $params); return $this; } else { return parent::__call($name, $params); } }
/** * Proxy the calls to the Pusher object if the methods doesn't explixitly exist in this class. * * If the method called is not found in the Pusher Object continue with standard Yii behaviour */ public function __call($method, $params) { //Override the normal Yii functionality checking the Keen SDK for a matching method if (method_exists($this->_pusher, $method)) { return call_user_func_array(array($this->_pusher, $method), $params); } //Use standard Yii functionality, checking behaviours return parent::__call($method, $params); }
public function __call($name, $params) { if (strpos($name, static::INTERNAL_HANDLER) === 0 && isset($params[0]) && $params[0] instanceof \yii\base\Event) { $event = $params[0]; $handler = $this->_handlers[$event->name][$name]; if ($event instanceof Event) { $extraParams = $event->params; array_unshift($extraParams, $event); $event->result = call_user_func_array($handler, $extraParams); } else { call_user_func($handler, $event); } } else { return parent::__call($name, $params); } }
/** * Calls the named method which is not a class method. * * This method will check whether PSR-3 or Yii2 format is used and will execute the corresponding method. * * @param string $name The method name. * @param array $arguments Method arguments. * * @return mixed The method return value. */ public function __call($name, array $arguments) { // Intercept calls to the "log()" method if ($name === 'log' && !empty($arguments)) { // PSR-3 format $reflection = new ReflectionClass(YiiLogger::className()); if (in_array($arguments[0], array_keys($this->_monolog->getLevels())) && !in_array($arguments[1], array_keys($reflection->getConstants())) && (!isset($arguments[3]) || isset($arguments[3]) && is_array($arguments[3]))) { return call_user_func_array([$this, 'log'], $arguments); } // Yii2 format return call_user_func_array([$this, 'yiiLog'], $arguments); } // Execute Monolog methods, if they exists if (method_exists($this->_monolog, $name) && !method_exists($this, $name)) { return call_user_func_array([$this->_monolog, $name], $arguments); } return parent::__call($name, $arguments); }
public function __call($name, $params) { $methods = ['get', 'getasync', 'post', 'postasync', 'put', 'putasync', 'patch', 'patchasync']; if (in_array(strtolower($name), $methods)) { if (count($params) < 1) { throw new \InvalidArgumentException('Magic request methods require a URI and optional options array'); } $uri = $params[0]; if (isset($params[1]) && is_array($params[1])) { $params = $params[1]; if (isset($params['headers'])) { $params['headers']['Authorization'] = 'Bearer ' . $this->token; } else { $params['headers'] = ['Authorization' => 'Bearer ' . $this->token]; } } else { $params = ['headers' => ['Authorization' => 'Bearer ' . $this->token]]; } $query = []; if (isset($params['query'])) { $query = $params['query']; unset($params['query']); } $uri = static::buildUrl($this->baseUrl, $uri, $query); $result = call_user_func_array([$this->client, $name], [$uri, $params]); $this->_restObject->result($result); return $this->_restObject; } return parent::__call($name, $params); }
/** * @param string $name * @param array $params * @return mixed|object */ public function __call($name, $params) { $property = false !== ($query = strpos($name, 'Query')) ? mb_substr($name, 6, -5) : mb_substr($name, 6); $property = lcfirst($property) . 'Class'; if ($query) { return forward_static_call([$this->{$property}, 'find']); } if (isset($this->{$property})) { $config = []; if (isset($params[0]) && is_array($params[0])) { $config = $params[0]; } $config['class'] = $this->{$property}; return \Yii::createObject($config); } return parent::__call($name, $params); }
/** * Any requests to set or get attributes or call methods on this class that * are not found are redirected to the {@link IService} object. * @param string $name the method name * @param array $parameters the method parameters * @return mixed * @throws \Exception */ public function __call($name, $parameters) { try { return parent::__call($name, $parameters); } catch (\Exception $e) { if (method_exists($this->_service, $name)) { return call_user_func_array(array($this->_service, $name), $parameters); } else { throw $e; } } }
/** * Allows issuing all supported commands via magic methods. * * ```php * $redis->hmset(['test_collection', 'key1', 'val1', 'key2', 'val2']) * ``` * * @param string $name name of the missing method to execute * @param array $params method call arguments * @return mixed */ public function __call($name, $params) { $redisCommand = strtoupper(Inflector::camel2words($name, false)); if (in_array($redisCommand, $this->redisCommands)) { return $this->executeCommand($name, $params); } else { return parent::__call($name, $params); } }
/** * Calls the named method which is not a class method. * * This method will check if Wordpress client has the named method and will execute it if available. * Do not call this method directly as it is a PHP magic method that will be implicitly called when an unknown * method is being invoked. * * @param string $name The method name. * @param array $params Method parameters. * * @throws \Exception If error occurred an $catchExceptions set to false. * @return mixed The method return value. */ public function __call($name, $params) { // If method exists $client = $this->getClient(); if (method_exists($client, $name) && array_key_exists($name, $this->methodMap) && is_callable([$client, $name])) { $profile = "Running an XML-RPC API call: {$name}"; $token = "monitorbacklinks\\yii2wp\\Wordpress::{$name}"; $dataRetrieval = strpos($name, 'get') === 0; try { Yii::beginProfile($profile); // Initialize cache $cacheKey = [__CLASS__, $name, $params]; $info = $this->getQueryCacheInfo(); if (is_array($info)) { /* @var $cache \yii\caching\Cache */ $cache = $info[0]; } // Search result in the cache if (isset($cache) && $dataRetrieval) { if (($result = $cache->get($cacheKey)) !== false) { Yii::trace('Query result served from cache', $token); Yii::endProfile($profile); return $result; } } // Get result and but it to the cache $result = call_user_func_array([$client, $name], $params); if (isset($cache) && $dataRetrieval) { $cache->set($cacheKey, $result, $info[1], $info[2]); Yii::trace('Saved query result in cache', $token); } Yii::endProfile($profile); return $result; } catch (\Exception $exception) { Yii::endProfile($profile); if ($this->catchExceptions) { Yii::error($exception->getMessage(), $token); return $this->methodMap[$name]; } else { throw $exception; } } } return parent::__call($name, $params); }
/** * Magic function __call to check whether we still connected or not. Servers a bridget between this class and * its parent::__call method * @param string $name * @param array $params * @return mixed */ public function __call($name, $params) { if (strncasecmp($name, 'imap', 4) === 0) { $this->checkConnection(); $result = call_user_func_array($name, $params); $this->checkErrors(); return $result; } return parent::__call($name, $params); }
/** * Call forwarder * * @param string $method * @param array $arguments * @return mixed */ public function __call($method, $arguments) { list($prefix, $arguments) = $this->filterPrefix($arguments); $filesystem = $this->get($prefix); if (method_exists($filesystem, $method)) { $callback = array($filesystem, $method); return call_user_func_array($callback, $arguments); } return parent::__call($method, $arguments); }
/** * * @param string $name * @param array $params * @return mixed */ public function __call($name, $params) { $this->open(); //TODO 可能要禁止使用者调用connect之类的方法。 if (is_callable([$this->_redisconn_instance, $name], true)) { return call_user_func_array([$this->_redisconn_instance, $name], $params); } else { return parent::__call($name, $params); } }
/** * * @param string $method * @param array $params * @return mixed */ public function __call($method, $params) { try { return parent::__call($method, $params); } catch (UnknownMethodException $ex) { return $this->sendRequest($method, $params); } }
/** * Magic call to wrapped amazon aws methods. If not command found, then call parent component * @param string $name * @param array $params * @return mixed */ public function __call($name, $params) { $sdk = $this->getSdk(); if (is_callable([$sdk, $name])) { return call_user_func_array([$sdk, $name], $params); } return parent::__call($name, $params); }