當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Object::__call方法代碼示例

本文整理匯總了PHP中Nette\Object::__call方法的典型用法代碼示例。如果您正苦於以下問題:PHP Object::__call方法的具體用法?PHP Object::__call怎麽用?PHP Object::__call使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Nette\Object的用法示例。


在下文中一共展示了Object::__call方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __call

 public function __call($name, $args = [])
 {
     if (method_exists($this->acl, $name)) {
         return call_user_func_array([$this->acl, $name], $args);
     }
     return parent::__call($name, $args);
 }
開發者ID:zaxcms,項目名稱:framework,代碼行數:7,代碼來源:Acl.php

示例2: __call

 /**
  * Allows calling $column->icon() instead of $column->setIcon (Same for title, class, ...)
  * @param  string $name
  * @param  array  $args
  * @return mixed
  */
 public function __call($name, $args)
 {
     $method_setter = 'set' . ucfirst($name);
     if (method_exists($this, $method_setter)) {
         return Nette\Utils\Callback::invokeArgs([$this, $method_setter], $args);
     }
     parent::__call($name, $args);
 }
開發者ID:JakubKontra,項目名稱:datagrid,代碼行數:14,代碼來源:Object.php

示例3: __call

 public function __call($methodName, $args)
 {
     if (preg_match('|.*getModel([a-zA-Z0-9]+).*|', $methodName, $mtch)) {
         if (class_exists('Model\\' . $mtch[1] . 'Model')) {
             return $this->modelLoader->loadModel($mtch[1] . 'Model');
         }
     } else {
         return parent::__call($methodName, $args);
     }
 }
開發者ID:jurasm2,項目名稱:bubo,代碼行數:10,代碼來源:BaseModel.php

示例4: __call

 /**
  * @param string $name
  * @param array $args
  * @return mixed
  */
 public function __call($name, $args)
 {
     $function = 'newrelic_' . self::convertCamelCaseToUnderscore($name);
     if (!extension_loaded('newrelic')) {
         return FALSE;
     }
     if (!function_exists($function)) {
         return parent::__call($name, $args);
     }
     return call_user_func_array($function, $args);
 }
開發者ID:damejidlo,項目名稱:newrelic,代碼行數:16,代碼來源:Client.php

示例5: __call

 public function __call($name, $args)
 {
     foreach ($this->getExtensions() as $extension) {
         /* @var $extension ExtensionObject */
         if ($extension->getReflection()->hasMethod($name)) {
             $method = $extension->getReflection()->getMethod($name);
             if ($method->isPublic() && !$method->isStatic() && !$method->isAbstract()) {
                 return \callback($extension, $name)->invokeArgs($args);
             }
         }
         if ($extension->getReflection()->hasEventProperty($name)) {
             return ObjectMixin::call($extension, $name, $args);
         }
     }
     return parent::__call($name, $args);
 }
開發者ID:jsmitka,項目名稱:ExtensionObjects,代碼行數:16,代碼來源:ExtensibleObject.php

示例6: __call

	/**
	 * Call a template run-time helper. Do not call directly.
	 * @param  string  helper name
	 * @param  array   arguments
	 * @return mixed
	 */
	public function __call($name, $args)
	{
		$lname = strtolower($name);
		if (!isset($this->helpers[$lname])) {
			foreach ($this->helperLoaders as $loader) {
				$helper = $loader/*5.2*->invoke*/($lname);
				if ($helper) {
					$this->registerHelper($lname, $helper);
					return $this->helpers[$lname]->invokeArgs($args);
				}
			}
			return parent::__call($name, $args);
		}

		return $this->helpers[$lname]->invokeArgs($args);
	}
開發者ID:redhead,項目名稱:nette,代碼行數:22,代碼來源:Template.php

示例7: __call

 /**
  * @param string $name
  * @param array $args
  * @return mixed
  * @throws IOException
  */
 public function __call($name, $args)
 {
     if (isset(self::$fileArg[$name])) {
         $dir = $this->dir;
         $args[self::$fileArg[$name]] = is_array($args[self::$fileArg[$name]]) ? array_map(function ($arg) use($dir) {
             return $dir . DIRECTORY_SEPARATOR . $arg;
         }, $args[self::$fileArg[$name]]) : $this->dir . DIRECTORY_SEPARATOR . $args[self::$fileArg[$name]];
         try {
             call_user_func_array(array($this->io, $name), $args);
             return $this;
         } catch (SfException $e) {
             throw new IOException($e->getMessage(), 0, $e);
         }
     }
     return parent::__call($name, $args);
 }
開發者ID:kdyby,項目名稱:filesystem,代碼行數:22,代碼來源:Dir.php

示例8: __call

 public function __call($name, $args)
 {
     if (preg_match('~^create(Select|Update|Delete|Insert)$~', $name, $m)) {
         #query object factory
         $class = "Flunorette\\Queries\\{$m[1]}Query";
         $queryContext = new QueryContext(reset($args), $this);
         return new $class($queryContext);
     }
     return parent::__call($name, $args);
 }
開發者ID:icaine,項目名稱:flunorette,代碼行數:10,代碼來源:Connection.php

示例9: __call

 /**
  * Call to undefined method.
  *
  * @param  string  method name
  * @param  array   arguments
  * @return mixed
  * @throws Nette\MemberAccessException
  */
 public function __call($name, $args)
 {
     $function = 'image' . $name;
     if (function_exists($function)) {
         foreach ($args as $key => $value) {
             if ($value instanceof self) {
                 $args[$key] = $value->getImageResource();
             } elseif (is_array($value) && isset($value['red'])) {
                 // rgb
                 $args[$key] = imagecolorallocatealpha($this->image, $value['red'], $value['green'], $value['blue'], $value['alpha']);
             }
         }
         array_unshift($args, $this->image);
         $res = call_user_func_array($function, $args);
         return is_resource($res) && get_resource_type($res) === 'gd' ? $this->setImageResource($res) : $res;
     }
     return parent::__call($name, $args);
 }
開發者ID:VasekPurchart,項目名稱:khanovaskola-v3,代碼行數:26,代碼來源:Image.php

示例10: catch

 /**
  * Calls internal facebook SDK task
  *
  * @param  string $name
  * @param  array $args
  * @return mixed
  */
 function __call($name, $args)
 {
     try {
         return NCallback::invokeArgs(array($this->fb, $name), $args);
     } catch (Nette\InvalidArgumentException $e) {
         return parent::__call($name, $args);
     }
 }
開發者ID:uestla,項目名稱:facebook-sdk-facade,代碼行數:15,代碼來源:FacebookFacade.php

示例11: __call

 /**
  * Call a template run-time helper. Do not call directly.
  * @param  string  helper name
  * @param  array   arguments
  * @return mixed
  */
 public function __call($name, $args)
 {
     $lname = strtolower($name);
     if (!isset($this->helpers[$lname])) {
         foreach ($this->helperLoaders as $loader) {
             $helper = Callback::invoke($loader, $lname);
             if ($helper) {
                 $this->registerHelper($lname, $helper);
                 return Callback::invokeArgs($this->helpers[$lname], $args);
             }
         }
         return parent::__call($name, $args);
     }
     return Callback::invokeArgs($this->helpers[$lname], $args);
 }
開發者ID:nette,項目名稱:deprecated,代碼行數:21,代碼來源:Template.php

示例12: __call

 /**
  * @param  string $name
  * @param  array $args
  * @return mixed
  */
 public function __call($name, $args)
 {
     if (strncmp($name, 'getBy', 5) === 0 && strlen($name) > 5) {
         $selection = $this->getTable()->limit(1);
         $properties = explode('And', substr($name, 5));
         if (count($properties) !== count($args)) {
             throw new Exception\InvalidArgumentException('Wrong number of argument passed to ' . $name . ' method - ' . count($properties) . ' expected, ' . count($args) . ' given.');
         }
         $ref = Reflection\EntityType::from($class = $this->getEntityClass());
         foreach ($properties as $key => $property) {
             $property = lcfirst($property);
             $prop = $ref->getEntityProperty($property);
             if ($prop === NULL) {
                 throw new Exception\InvalidArgumentException("Property '\${$property}' not found in entity '{$class}'.");
             }
             $selection->where($prop->getColumn(), $args[$key]);
         }
         return $this->createEntityFromSelection($selection);
     } elseif (strncmp($name, 'findBy', 6) === 0 && strlen($name) > 6) {
         $selection = $this->getTable();
         $properties = explode('And', substr($name, 6));
         if (count($properties) !== count($args)) {
             throw new Exception\InvalidArgumentException('Wrong number of argument passed to ' . $name . ' method - ' . count($properties) . ' expected, ' . count($args) . ' given.');
         }
         $criteria = [];
         $ref = Reflection\EntityType::from($class = $this->getEntityClass());
         foreach ($properties as $key => $property) {
             $property = lcfirst($property);
             $prop = $ref->getEntityProperty($property);
             if ($prop === NULL) {
                 throw new Exception\InvalidArgumentException("Property '\${$property}' not found in entity '{$class}'.");
             }
             $criteria[$prop->getColumn()] = $args[$key];
         }
         return $this->findBy($criteria);
     }
     return parent::__call($name, $args);
 }
開發者ID:uestla,項目名稱:yetorm,代碼行數:43,代碼來源:Repository.php

示例13: __call

 public function __call($method, $args)
 {
     if (isset($this->proxyMethods[strtolower($method)])) {
         if (FindByParserHelper::parse($method, $args)) {
             return call_user_func([$this, $method], $args);
         }
         $result = call_user_func_array([$this->mapper, $method], $args);
         if (!($result instanceof ICollection || $result instanceof IEntity || $result === NULL)) {
             $result = $this->mapper->toCollection($result);
         }
         return $result;
     } else {
         return parent::__call($method, $args);
     }
 }
開發者ID:Vyki,項目名稱:orm,代碼行數:15,代碼來源:Repository.php

示例14: __call

 /**
  * Method overload for findBy...
  *
  * @param string $name
  * @param array $args
  * @return mixed
  * @throws InvalidArgumentException
  */
 public function __call($name, $args)
 {
     if (strncmp($name, 'findBy', 6) === 0 && strlen($name) > 6) {
         $name = lcfirst(substr($name, 6));
         $metadata = Metadata::getMetadata($this->entity);
         $identityMap = $this->em->getIdentityMap($this->entity);
         return $identityMap->map($this->em->connection->select("*")->from($metadata->tableName)->where("[" . Tools::underscore($name) . "] = " . $this->getModificator($name), $args[0])->execute()->fetch());
     } else {
         return parent::__call($name, $args);
     }
 }
開發者ID:nella,項目名稱:ActiveMapper,代碼行數:19,代碼來源:DibiRepository.php

示例15: __call

 /**
  * Method overload for findBy...
  *
  * @param string $name
  * @param array $args
  * @return mixed
  * @throws InvalidArgumentException
  */
 public function __call($name, $args)
 {
     if (strncmp($name, 'findBy', 6) === 0 && strlen($name) > 6) {
         $entity = $args[0];
         unset($args[0]);
         return callback($this->getRepository($entity), $name)->invokeArgs($args);
     } else {
         return parent::__call($name, $args);
     }
 }
開發者ID:nella,項目名稱:ActiveMapper,代碼行數:18,代碼來源:Manager.php


注:本文中的Nette\Object::__call方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。