当前位置: 首页>>代码示例>>PHP>>正文


PHP Component::__call方法代码示例

本文整理汇总了PHP中yii\base\Component::__call方法的典型用法代码示例。如果您正苦于以下问题:PHP Component::__call方法的具体用法?PHP Component::__call怎么用?PHP Component::__call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\base\Component的用法示例。


在下文中一共展示了Component::__call方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __call

 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);
 }
开发者ID:nmdimas,项目名称:php-mailgun,代码行数:7,代码来源:MailgunYii2.php

示例2: __call

 /**
  * @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);
 }
开发者ID:pavlinter,项目名称:yii2-adm,代码行数:37,代码来源:Manager.php

示例3: __call

 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);
 }
开发者ID:sammaye,项目名称:yii2-rackspace,代码行数:7,代码来源:Rackspace.php

示例4: __call

 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);
 }
开发者ID:serieznyi,项目名称:yii2-imbo-file-api,代码行数:7,代码来源:Imbo.php

示例5: __call

 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);
 }
开发者ID:jenn0pal,项目名称:yii2-aws-sdk,代码行数:8,代码来源:AwsSdk.php

示例6: __call

 /**
  * 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);
     }
 }
开发者ID:keano19,项目名称:yii2-adldap-module,代码行数:16,代码来源:Ldap.php

示例7: __call

 public function __call($name, $params)
 {
     $ucFunctionName = 'uc_' . $name;
     if (function_exists($ucFunctionName)) {
         return call_user_func_array($ucFunctionName, $params);
     }
     return parent::__call($name, $params);
 }
开发者ID:HelloMrShu,项目名称:yii2-ucenter-1,代码行数:8,代码来源:Client.php

示例8: __call

 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);
 }
开发者ID:grigorieff,项目名称:yii2-aws,代码行数:8,代码来源:AWSComponent.php

示例9: __call

 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);
     }
 }
开发者ID:filsh,项目名称:yii2-google-geocoder,代码行数:9,代码来源:Geocoder.php

示例10: __call

 /**
  * 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);
 }
开发者ID:br0sk,项目名称:yii2-pusher,代码行数:14,代码来源:Pusher.php

示例11: __call

 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);
     }
 }
开发者ID:sangkilsoft,项目名称:sangkilbiz-3,代码行数:16,代码来源:Hooks.php

示例12: __call

 /**
  * 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);
 }
开发者ID:uniconstructor,项目名称:yii2-monolog,代码行数:28,代码来源:Logger.php

示例13: __call

 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);
 }
开发者ID:mole-chen,项目名称:yii2,代码行数:30,代码来源:Client.php

示例14: __call

 /**
  * @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);
 }
开发者ID:romulolink,项目名称:newTwitter,代码行数:22,代码来源:ModelManager.php

示例15: __call

 /**
  * 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;
         }
     }
 }
开发者ID:strong2much,项目名称:yii2-sms,代码行数:20,代码来源:SmsManager.php


注:本文中的yii\base\Component::__call方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。