예제 #1
0
파일: Abstract.php 프로젝트: robeendey/ce
 /**
  * load() - called by the client initialize routine to load files
  *
  */
 public function load()
 {
     $this->_retrievedFiles = $this->getRetrievedFiles();
     $this->_loadedClasses = array();
     $manifestRegistry = $this->_registry->getManifestRepository();
     $providerRegistry = $this->_registry->getProviderRepository();
     $loadedClasses = array();
     // loop through files and find the classes declared by loading the file
     foreach ($this->_retrievedFiles as $file) {
         $classesLoadedBefore = get_declared_classes();
         $oldLevel = error_reporting(E_ALL | ~E_STRICT);
         // remove strict so that other packages wont throw warnings
         // should we lint the files here? i think so
         include_once $file;
         error_reporting($oldLevel);
         // restore old error level
         $classesLoadedAfter = get_declared_classes();
         $loadedClasses = array_merge($loadedClasses, array_diff($classesLoadedAfter, $classesLoadedBefore));
     }
     // loop through the loaded classes and ensure that
     foreach ($loadedClasses as $loadedClass) {
         // reflect class to see if its something we want to load
         $reflectionClass = new ReflectionClass($loadedClass);
         if ($reflectionClass->implementsInterface('Zend_Tool_Framework_Manifest_Interface') && !$reflectionClass->isAbstract()) {
             $manifestRegistry->addManifest($reflectionClass->newInstance());
             $this->_loadedClasses[] = $loadedClass;
         }
         if ($reflectionClass->implementsInterface('Zend_Tool_Framework_Provider_Interface') && !$reflectionClass->isAbstract() && !$providerRegistry->hasProvider($reflectionClass->getName(), false)) {
             $providerRegistry->addProvider($reflectionClass->newInstance());
             $this->_loadedClasses[] = $loadedClass;
         }
     }
     return $this->_loadedClasses;
 }
예제 #2
0
    /**
     * @param  ReflectionClass $reflectionClass
     * @return bool
     */
    private function _isProviderImplementation($reflectionClass)
    {
        $providerRegistry = $this->_registry->getProviderRepository();

        return (
            $reflectionClass->implementsInterface('Zend_Tool_Framework_Provider_Interface')
                && !$reflectionClass->isAbstract()
                && !$providerRegistry->hasProvider($reflectionClass->getName(), false)
        );
    }