Nette\Reflection\Method::from PHP Méthode

from() public static méthode

public static from ( $class, $method ) : self
Résultat self
    public static function from($class, $method)
    {
        return new static(is_object($class) ? get_class($class) : $class, $method);
    }

Usage Example

 private function addComponentFactories(array $factories)
 {
     $builder = $this->getContainerBuilder();
     foreach ($factories as $component => $factory) {
         if (strpos($factory, '::') === FALSE) {
             $factory .= '::' . self::DEFAULT_FACTORY_METHOD;
         }
         if ($builder->hasDefinition($name = $this->prefix('registry.' . $component))) {
             $definition = $builder->getDefinition($name);
         } else {
             $definition = $builder->addDefinition($name)->addTag(self::TAG_COMPONENT_REGISTRY, $component)->setAutowired(FALSE);
         }
         list($class, $method) = explode('::', $factory);
         if (!Method::from($class, $method)->isStatic()) {
             $factory = '@' . $factory;
         }
         $definition->setFactory($factory);
     }
 }
All Usage Examples Of Nette\Reflection\Method::from