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


PHP AnnotationsParser::expandClassName方法代码示例

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


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

示例1: registerAnnotations

 /**
  * Registers repositories from annotations
  */
 private function registerAnnotations()
 {
     $ref = Nette\Reflection\ClassType::from($this);
     $annotations = $ref->getAnnotations();
     if (isset($annotations['property-read'])) {
         $c = get_called_class();
         $namespace = substr($c, 0, strrpos($c, '\\'));
         foreach ($annotations['property-read'] as $value) {
             if (preg_match('#^([\\\\\\w]+Repository)\\s+\\$(\\w+)$#', $value, $m)) {
                 $class = '\\' . Reflection\AnnotationsParser::expandClassName($m[1], $ref);
                 $this->register($m[2], $class);
                 $this->aliases[$m[2]] = $class;
             }
         }
     }
 }
开发者ID:VasekPurchart,项目名称:khanovaskola-v3,代码行数:19,代码来源:RepositoryContainer.php

示例2: detectClass

 /**
  * @param ServiceDefinition
  * @return string|null
  */
 protected static function detectClass(ServiceDefinition $def)
 {
     if ($def->getClass()) {
         return $def->getClass();
     } elseif ($interface = $def->getImplement()) {
         $rc = Reflection\ClassType::from($interface);
         $method = $rc->hasMethod('create') ? 'create' : ($rc->hasMethod('get') ? 'get' : NULL);
         if ($method === NULL) {
             return NULL;
         }
         if (!($returnType = $rc->getMethod($method)->getAnnotation('return'))) {
             return NULL;
         }
         return Reflection\AnnotationsParser::expandClassName(preg_replace('#[|\\s].*#', '', $returnType), $rc);
     }
     return NULL;
 }
开发者ID:librette,项目名称:setup,代码行数:21,代码来源:SetupExtension.php

示例3: getRepositoryList

 protected function getRepositoryList($modelClass)
 {
     $modelReflection = new ClassType($modelClass);
     $builder = $this->getContainerBuilder();
     $builder->addDependency($modelReflection->getFileName());
     $repositories = [];
     foreach ($modelReflection->getAnnotations() as $key => $annotations) {
         if ($key !== 'property-read') {
             continue;
         }
         foreach ($annotations as $annotation) {
             list($class, $name) = preg_split('#\\s+#', $annotation);
             $class = AnnotationsParser::expandClassName($class, $modelReflection);
             if (!class_exists($class)) {
                 throw new RuntimeException("Repository '{$class}' does not exist.");
             }
             $repositories[ltrim($name, '$')] = $class;
         }
     }
     return $repositories;
 }
开发者ID:Vyki,项目名称:orm,代码行数:21,代码来源:OrmExtension.php

示例4: getRepositoryList

 protected function getRepositoryList($modelClass)
 {
     $modelReflection = new ClassType($modelClass);
     $builder = $this->getContainerBuilder();
     $builder->addDependency($modelReflection->getFileName());
     $repositories = [];
     foreach ($modelReflection->getAnnotations() as $key => $annotations) {
         if ($key !== 'property-read') {
             continue;
         }
         foreach ($annotations as $annotation) {
             list($class, $name) = preg_split('#\\s+#', $annotation);
             $class = AnnotationsParser::expandClassName($class, $modelReflection);
             if (!class_exists($class)) {
                 throw new RuntimeException("Class repository '{$class}' does not exist.");
             }
             $repositories[] = ['name' => ltrim($name, '$'), 'serviceName' => $this->prefix('repositories.' . ltrim($name, '$')), 'class' => $class, 'entities' => call_user_func([$class, 'getEntityClassNames'])];
         }
     }
     return $repositories;
 }
开发者ID:Zarganwar,项目名称:orm,代码行数:21,代码来源:OrmExtension.php

示例5: beforeCompile

    public function beforeCompile()
    {
        $builder = $this->getContainerBuilder();
        $config = $this->getConfig($this->defaults);
        foreach ($builder->getDefinitions() as $def) {
            /** @var $def ServiceDefinition */
            $class = $def->class ?: ($def->factory ? $def->factory->entity : NULL);
            if (!$class || !class_exists($class)) {
                continue;
            }
            $classes = class_parents($class) + array('@self' => $class);
            foreach ($classes as $class) {
                $rc = ClassType::from($class);
                foreach ($rc->getProperties() as $rp) {
                    if (!$rp->hasAnnotation($config['annotationName'])) {
                        continue;
                    }
                    $fullPropName = $rp->getDeclaringClass()->getName() . '::$' . $rp->getName();
                    if ($rp->isStatic()) {
                        trigger_error('Injects are not supported on static properties, found on ' . $fullPropName . '.', E_USER_WARNING);
                        continue;
                    }
                    $var = (string) $rp->getAnnotation('var');
                    if (!$var) {
                        throw new CompileException('@var annotation on ' . $fullPropName . ' is missing or empty.');
                    }
                    $m = Strings::match(trim($var), '~
							(?<name>\\\\?[a-z][a-z0-9_]*(?:\\\\[a-z][a-z0-9_]*)*)   # class name
							(?<multiple>(?:\\[\\])?)   # array of types
							\\z
						~Aix');
                    if (!$m) {
                        throw new CompileException('@var annotation on ' . $fullPropName . ' contains invalid value.');
                    }
                    $type = AnnotationsParser::expandClassName($m['name'], $rp->getDeclaringClass());
                    $def->addSetup(__NAMESPACE__ . '\\Helpers::writeProperty(?, ?, ?, ' . (!empty($m['multiple']) ? __NAMESPACE__ . '\\Helpers::findServicesOfType(?, $this)' : '$this->getByType(?)') . ')', array('@self', $rp->getDeclaringClass()->getName(), $rp->getName(), $type));
                }
            }
        }
    }
开发者ID:darkknightik,项目名称:nette-injects-extension,代码行数:40,代码来源:InjectsExtension.php

示例6: resolveClass

 private function resolveClass($name, $recursive = array())
 {
     if (isset($recursive[$name])) {
         throw new ServiceCreationException(sprintf('Circular reference detected for services: %s.', implode(', ', array_keys($recursive))));
     }
     $recursive[$name] = TRUE;
     $def = $this->definitions[$name];
     $factory = $def->factory->entity;
     if ($def->class) {
         return $def->class;
     } elseif (is_array($factory)) {
         // method calling
         if ($service = $this->getServiceName($factory[0])) {
             if (Strings::contains($service, '\\')) {
                 // @\Class
                 $factory[0] = $service;
             } else {
                 $factory[0] = $this->resolveClass($service, $recursive);
                 if (!$factory[0]) {
                     return;
                 }
                 if ($this->definitions[$service]->implement && $factory[1] === 'create') {
                     return $def->class = $factory[0];
                 }
             }
         }
         try {
             $reflection = Nette\Utils\Callback::toReflection($factory);
         } catch (\ReflectionException $e) {
         }
         if (isset($e) || !is_callable($factory)) {
             throw new ServiceCreationException(sprintf("Factory '%s' used in service '%s' is not callable.", Nette\Utils\Callback::toString($factory), $name));
         }
         $def->class = preg_replace('#[|\\s].*#', '', $reflection->getAnnotation('return'));
         if ($def->class && $reflection instanceof \ReflectionMethod) {
             $def->class = Reflection\AnnotationsParser::expandClassName($tmp = $def->class, $reflection->getDeclaringClass());
             if ($tmp !== $def->class && $tmp[0] !== '\\' && class_exists($tmp)) {
                 $def->class = $tmp;
                 trigger_error("You should use @return \\{$tmp}' in {$reflection}.", E_USER_WARNING);
             }
         }
     } elseif ($service = $this->getServiceName($factory)) {
         // alias or factory
         if (!$def->implement) {
             $def->autowired = FALSE;
         }
         if (Strings::contains($service, '\\')) {
             // @\Class
             return $def->class = $service;
         }
         if ($this->definitions[$service]->implement) {
             $def->autowired = FALSE;
         }
         return $def->class = $this->definitions[$service]->implement ?: $this->resolveClass($service, $recursive);
     } else {
         return $def->class = $factory;
         // class name
     }
 }
开发者ID:pdostal,项目名称:nette-blog,代码行数:59,代码来源:ContainerBuilder.php

示例7: loadAnnotationProperties

 /**
  * @param  string $class
  * @return void
  */
 private static function loadAnnotationProperties($class)
 {
     if (!isset(self::$annProps[$class])) {
         self::$annProps[$class] = [];
         $ref = $class::getReflection();
         foreach ($ref->getAnnotations() as $ann => $values) {
             if ($ann === 'property' || $ann === 'property-read') {
                 foreach ($values as $tmp) {
                     $matches = NStrings::match($tmp, '#^[ \\t]*(?P<type>\\\\?[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*(?:\\\\[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)*(?:\\|\\\\?[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*(?:\\\\[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)*)?)[ \\t]+(?P<property>\\$[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)(?:[ \\t]+->[ \\t]+(?P<column>[a-zA-Z0-9_-]+))?[ \\t]*(?P<description>.*)\\z#');
                     if ($matches === NULL) {
                         throw new YetORM\Exception\InvalidStateException('Invalid property definition - "@' . $ann . ' ' . $tmp . '" does not match "@property[-read] <type> $<property> [-> <column>][ <description>]" pattern.');
                     }
                     $nullable = FALSE;
                     $type = $matches['type'];
                     $types = explode('|', $type, 2);
                     if (count($types) === 2) {
                         if (strcasecmp($types[0], 'NULL') === 0) {
                             $nullable = TRUE;
                             $type = $types[1];
                         }
                         if (strcasecmp($types[1], 'NULL') === 0) {
                             if ($nullable) {
                                 throw new YetORM\Exception\InvalidStateException('Invalid property type (double NULL).');
                             }
                             $nullable = TRUE;
                             $type = $types[0];
                         }
                         if (!$nullable) {
                             throw new YetORM\Exception\InvalidStateException('Invalid property type (multiple non-NULL types detected).');
                         }
                     }
                     if ($type === 'bool') {
                         $type = 'boolean';
                     } elseif ($type === 'int') {
                         $type = 'integer';
                     }
                     if (!EntityProperty::isNativeType($type)) {
                         $type = AnnotationsParser::expandClassName($type, $ref);
                     }
                     $readonly = $ann === 'property-read';
                     $name = substr($matches['property'], 1);
                     $column = strlen($matches['column']) ? $matches['column'] : $name;
                     $description = strlen($matches['description']) ? $matches['description'] : NULL;
                     self::$annProps[$class][$name] = new AnnotationProperty($ref, $name, $readonly, $type, $column, $nullable, $description);
                 }
             }
         }
     }
 }
开发者ID:uestla,项目名称:yetorm,代码行数:53,代码来源:EntityType.php

示例8: processKeyword

 private function processKeyword($value, ReflectionClass $reflectionClass)
 {
     if (strcasecmp($value, 'true') === 0) {
         return TRUE;
     } elseif (strcasecmp($value, 'false') === 0) {
         return FALSE;
     } elseif (strcasecmp($value, 'null') === 0) {
         return NULL;
     } elseif (is_numeric($value)) {
         return $value * 1;
     } elseif (preg_match('#^[a-z0-9_\\\\]+::[a-z0-9_]+(\\*)?$#i', $value)) {
         list($className, $const) = explode('::', $value, 2);
         if ($className === 'self' || $className === 'static') {
             $reflection = $reflectionClass;
         } else {
             $className = AnnotationsParser::expandClassName($className, $reflectionClass);
             $reflection = new ReflectionClass($className);
         }
         $enum = [];
         $constants = $reflection->getConstants();
         if (strpos($const, '*') !== FALSE) {
             $prefix = rtrim($const, '*');
             $prefixLength = strlen($prefix);
             $count = 0;
             foreach ($constants as $name => $value) {
                 if (substr($name, 0, $prefixLength) === $prefix) {
                     $enum[$value] = $value;
                     $count += 1;
                 }
             }
             if ($count === 0) {
                 throw new InvalidModifierDefinitionException("No constant matches {$reflection->name}::{$const} pattern.");
             }
         } else {
             if (!array_key_exists($const, $constants)) {
                 throw new InvalidModifierDefinitionException("Constant {$reflection->name}::{$const} does not exist.");
             }
             $value = $reflection->getConstant($const);
             $enum[$value] = $value;
         }
         return array_values($enum);
     } else {
         return $value;
     }
 }
开发者ID:Vyki,项目名称:orm,代码行数:45,代码来源:ModifierParser.php

示例9: makeFQN

 protected function makeFQN($name)
 {
     return AnnotationsParser::expandClassName($name, $this->currentReflection);
 }
开发者ID:Vyki,项目名称:orm,代码行数:4,代码来源:MetadataParser.php

示例10: resolveClass

 private function resolveClass($name, $recursive = array())
 {
     if (isset($recursive[$name])) {
         throw new ServiceCreationException('Circular reference detected for services: ' . implode(', ', array_keys($recursive)) . '.');
     }
     $recursive[$name] = TRUE;
     $def = $this->definitions[$name];
     $factory = $def->factory->entity;
     if ($def->class) {
         return $def->class;
     } elseif (is_array($factory)) {
         // method calling
         if ($service = $this->getServiceName($factory[0])) {
             if (Strings::contains($service, '\\')) {
                 // @\Class
                 $factory[0] = $service;
             } else {
                 $factory[0] = $this->resolveClass($service, $recursive);
                 if (!$factory[0]) {
                     return;
                 }
                 if ($this->definitions[$service]->implement && $factory[1] === 'create') {
                     return $def->class = $factory[0];
                 }
             }
         }
         if (!is_callable($factory)) {
             throw new ServiceCreationException("Factory '" . Nette\Utils\Callback::toString($factory) . "' is not callable.");
         }
         try {
             $reflection = Nette\Utils\Callback::toReflection($factory);
         } catch (\ReflectionException $e) {
             throw new ServiceCreationException("Missing factory '" . Nette\Utils\Callback::toString($factory) . "'.");
         }
         $def->class = preg_replace('#[|\\s].*#', '', $reflection->getAnnotation('return'));
         if ($def->class && $reflection instanceof \ReflectionMethod) {
             $def->class = Reflection\AnnotationsParser::expandClassName($def->class, $reflection->getDeclaringClass());
         }
     } elseif ($service = $this->getServiceName($factory)) {
         // alias or factory
         if (!$def->implement) {
             $def->autowired = FALSE;
         }
         if (Strings::contains($service, '\\')) {
             // @\Class
             return $def->class = $service;
         }
         if ($this->definitions[$service]->implement) {
             $def->autowired = FALSE;
         }
         return $def->class = $this->definitions[$service]->implement ?: $this->resolveClass($service, $recursive);
     } else {
         return $def->class = $factory;
         // class name
     }
 }
开发者ID:rostenkowski,项目名称:nette,代码行数:56,代码来源:ContainerBuilder.php

示例11: addProperty

 /**
  * @param MetaData $metaData
  * @param string $string
  * @param string $mode ::READWRITE|MetaData::READ|MetaData::WRITE
  * @param string $class
  * @param ReflectionClass $r
  */
 private function addProperty(MetaData $metaData, $string, $mode, $class, ReflectionClass $r)
 {
     if ($mode === MetaData::READWRITE) {
         if (preg_match('#^(-read|-write)?\\s?(.*)$#si', $string, $match)) {
             $mode = $match[1];
             $mode = ((!$mode or $mode === '-read') ? MetaData::READ : 0) | ((!$mode or $mode === '-write') ? MetaData::WRITE : 0);
             $string = $match[2];
         }
     }
     if (preg_match('#^([a-z0-9_\\[\\]\\|\\\\]+)\\s+\\$([a-z0-9_]+)($|\\s(.*)$)#si', $string, $match)) {
         $property = $match[2];
         $type = $match[1];
         $string = $match[3];
     } else {
         if (preg_match('#^\\$([a-z0-9_]+)\\s+([a-z0-9_\\|\\\\]+)($|\\s(.*)$)#si', $string, $match)) {
             $property = $match[1];
             $type = $match[2];
             $string = $match[3];
         } else {
             if (preg_match('#^\\$([a-z0-9_]+)($|\\s(.*)$)#si', $string, $match)) {
                 $property = $match[1];
                 $type = 'mixed';
                 $string = $match[2];
             } else {
                 $tmp = $mode === MetaData::READ ? '-read' : '';
                 throw new AnnotationMetaDataException("Invalid annotation format '@property{$tmp} {$string}' in {$class}");
             }
         }
     }
     if (strpos(strToLower($string), '{ignore}') !== FALSE) {
         return;
     }
     $propertyName = $property;
     // Support for simplified FQN '@property Foo' instead of '@property \App\Foo'
     $parts = explode('|', $type);
     foreach ($parts as &$part) {
         $fqn = NetteAnnotationsParser::expandClassName($part, $r);
         if (class_exists($fqn)) {
             $part = $fqn;
         }
         if ($part === Orm\OneToMany::class) {
             // Support for '@property OtM|Foo[]' instead of '@property Orm\OneToMany'
             $parts = [Orm\OneToMany::class];
             break;
         } else {
             if ($part === Orm\ManyToMany::class) {
                 // Support for '@property MtM|Foo[]' instead of '@property Orm\ManyToMany'
                 $parts = [Orm\ManyToMany::class];
                 break;
             } else {
                 if (substr($part, -2) === '[]') {
                     $part = 'array';
                 }
             }
         }
     }
     $type = implode('|', $parts);
     $property = $metaData->addProperty($propertyName, $type, $mode, $class);
     $this->property = [$propertyName, $property];
     $string = preg_replace_callback('#\\{\\s*([^\\s\\}\\{]+)(?:\\s+([^\\}\\{]*))?\\s*\\}#si', [$this, 'callOnMacro'], $string);
     $this->property = NULL;
     if (preg_match('#\\{|\\}#', $string)) {
         $string = trim($string);
         throw new AnnotationMetaDataException("Invalid annotation format, extra curly bracket '{$string}' in {$class}::\${$propertyName}");
     }
 }
开发者ID:VasekPurchart,项目名称:khanovaskola-v3,代码行数:73,代码来源:AnnotationMetaData.php

示例12: getEntityClass

 /** @return string */
 protected final function getEntityClass()
 {
     if ($this->entity === NULL) {
         $ref = static::getReflection();
         if (($annotation = $ref->getAnnotation('entity')) === NULL) {
             throw new Exception\InvalidStateException('Entity class not set.');
         }
         $this->entity = AnnotationsParser::expandClassName($annotation, $ref);
     }
     return $this->entity;
 }
开发者ID:uestla,项目名称:yetorm,代码行数:12,代码来源:Repository.php

示例13: getInjectProperties

 /**
  * Generates list of properties with annotation @inject.
  * @return array
  */
 public static function getInjectProperties(Nette\Reflection\ClassType $class)
 {
     $res = array();
     foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
         $type = $property->getAnnotation('var');
         if (!$property->getAnnotation('inject')) {
             continue;
         } elseif (!$type) {
             throw new Nette\InvalidStateException("Property {$property} has not @var annotation.");
         }
         $type = Nette\Reflection\AnnotationsParser::expandClassName($type, $property->getDeclaringClass());
         if (!class_exists($type) && !interface_exists($type)) {
             throw new Nette\InvalidStateException("Class or interface '{$type}' used in @var annotation at {$property} not found.");
         }
         $res[$property->getName()] = $type;
     }
     return $res;
 }
开发者ID:prcharom,项目名称:w-pps-reality,代码行数:22,代码来源:Helpers.php

示例14: InjectableTrait_getInjectionByTypeProperties

 /**
  * Returns array of properties needed to be injected.
  * Keys of array are property names, values are service types.
  *
  * Name must match with InjectionCompilerExtension::IIS_GET_INJECTION_PROPS_METHOD
  *
  * @return array
  */
 public static function InjectableTrait_getInjectionByTypeProperties()
 {
     $injectionProperties = [];
     $properties = static::InjectableTrait_getReflection()->getProperties();
     foreach ($properties as $property) {
         if ($property->hasAnnotation(AService::INJECT_SERVICE_ANNOTATION)) {
             $serviceName = $property->getAnnotation(AService::INJECT_SERVICE_ANNOTATION);
             $type = $property->getAnnotation(AService::TYPE_ANNOTATION);
             if (($serviceName === true || strlen($serviceName) === 0) && $type !== null) {
                 $type = AnnotationsParser::expandClassName($type, $property->getDeclaringClass());
                 $injectionProperties[$property->name] = $type;
             }
         }
     }
     return $injectionProperties;
 }
开发者ID:dtforce,项目名称:nette-inject,代码行数:24,代码来源:InjectableTrait.php

示例15: prepareClassList

 /**
  * Generates $dependencies, $classes and normalizes class names.
  * @return array
  */
 public function prepareClassList()
 {
     $this->classes = FALSE;
     // prepare generated factories
     foreach ($this->definitions as $name => $def) {
         if (!$def->implement) {
             continue;
         }
         if (!interface_exists($def->implement)) {
             throw new ServiceCreationException("Interface {$def->implement} has not been found.");
         }
         $rc = Reflection\ClassType::from($def->implement);
         $method = $rc->hasMethod('create') ? $rc->getMethod('create') : ($rc->hasMethod('get') ? $rc->getMethod('get') : NULL);
         if (count($rc->getMethods()) !== 1 || !$method || $method->isStatic()) {
             throw new ServiceCreationException("Interface {$def->implement} must have just one non-static method create() or get().");
         }
         $def->implement = $rc->getName();
         $def->implementType = $rc->hasMethod('create') ? 'create' : 'get';
         if (!$def->class && empty($def->factory->entity)) {
             $returnType = $method->getAnnotation('return');
             if (!$returnType) {
                 throw new ServiceCreationException("Method {$method} has not @return annotation.");
             }
             $returnType = Reflection\AnnotationsParser::expandClassName($returnType, $rc);
             if (!class_exists($returnType)) {
                 throw new ServiceCreationException("Please check a @return annotation of the {$method} method. Class '{$returnType}' cannot be found.");
             }
             $def->setClass($returnType);
         }
         if ($method->getName() === 'get') {
             if ($method->getParameters()) {
                 throw new ServiceCreationException("Method {$method} must have no arguments.");
             }
             if (empty($def->factory->entity)) {
                 $def->setFactory('@\\' . ltrim($def->class, '\\'));
             } elseif (!$this->getServiceName($def->factory->entity)) {
                 throw new ServiceCreationException("Invalid factory in service '{$name}' definition.");
             }
         }
         if (!$def->parameters) {
             foreach ($method->getParameters() as $param) {
                 $paramDef = ($param->isArray() ? 'array' : $param->getClassName()) . ' ' . $param->getName();
                 if ($param->isOptional()) {
                     $def->parameters[$paramDef] = $param->getDefaultValue();
                 } else {
                     $def->parameters[] = $paramDef;
                 }
             }
         }
     }
     // complete class-factory pairs
     foreach ($this->definitions as $name => $def) {
         if (!$def->factory) {
             if (!$def->class) {
                 throw new ServiceCreationException("Class and factory are missing in service '{$name}' definition.");
             }
             $def->factory = new Statement($def->class);
         }
     }
     // check if services are instantiable
     foreach ($this->definitions as $name => $def) {
         $factory = $def->factory->entity = $this->normalizeEntity($def->factory->entity);
         if (is_string($factory) && preg_match('#^[\\w\\\\]+\\z#', $factory) && $factory !== self::THIS_SERVICE) {
             if (!class_exists($factory) || !Reflection\ClassType::from($factory)->isInstantiable()) {
                 throw new ServiceCreationException("Class {$factory} used in service '{$name}' has not been found or is not instantiable.");
             }
         }
     }
     // complete classes
     foreach ($this->definitions as $name => $def) {
         $this->resolveClass($name);
         if (!$def->class) {
             continue;
         } elseif (!class_exists($def->class) && !interface_exists($def->class)) {
             throw new ServiceCreationException("Class or interface {$def->class} used in service '{$name}' has not been found.");
         } else {
             $def->class = Reflection\ClassType::from($def->class)->getName();
         }
     }
     //  build auto-wiring list
     $this->classes = array();
     foreach ($this->definitions as $name => $def) {
         $class = $def->implement ?: $def->class;
         if ($def->autowired && $class) {
             foreach (class_parents($class) + class_implements($class) + array($class) as $parent) {
                 $this->classes[strtolower($parent)][] = (string) $name;
             }
         }
     }
     foreach ($this->classes as $class => $foo) {
         $this->addDependency(Reflection\ClassType::from($class)->getFileName());
     }
 }
开发者ID:cujan,项目名称:atlashornin,代码行数:97,代码来源:ContainerBuilder.php


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