示例#1
0
 /**
  * @return void
  */
 protected function prepareNamesMapping()
 {
     $resolver = $this->getFactory()->getNameResolver();
     $this->scanPhpDefinitions('src/Ext', function ($extended) use($resolver) {
         if (!$this->metadriver->isExtendable($extended)) {
             CompileTimeError::create('Class `%s` must implement <ExtendableInterface>', [$extended])->_throw();
         }
         // follow inheritence path of the extended class upto the abstract
         // class and add mapping entry of the current class URI to the name
         // of the extended class
         while (($parentClass = Php\Aux::getInstantiableParentClass($extended)) != null) {
             $parent_URI = $resolver->classNameTo_URI($parentClass);
             $this->metadriver->addURI_classNameMappingEntry($parent_URI, $extended);
         }
     });
     $this->scanPhpDefinitions('src', function ($className) use($resolver) {
         if (empty($className) || !Php\Aux::isInstantiable($className)) {
             return;
         }
         $URI_str = $resolver->classNameTo_URI($className);
         $this->metadriver->addURI_classNameMappingEntry($URI_str, $className);
     }, ['Ext', 'Component']);
 }