private function _getClassesFromDirectory($dir)
 {
     $cacheKey = "{$dir}.classesindir";
     $result = false;
     $classes = $this->_cache->fetch($cacheKey, $result);
     if ($result === true) {
         return $classes;
     }
     $classes = array();
     foreach ($this->_getCandidateFilesForClassScanning($dir) as $file) {
         $classes[$file] = $this->_getClassesFromFile($file);
     }
     $this->_cache->store($cacheKey, $classes);
     return $classes;
 }
Example #2
0
 /**
  * This will give you the name of a proxy class as a string. The class will
  * already exist in the vm.
  *
  * @return string
  */
 public function create($class, IDispatcher $dispatcher)
 {
     $subject = $this->reflectionFactory->getClass($class);
     $proxyClassName = 'Proxy' . str_replace('\\', '', $subject->getName());
     $cacheKey = $proxyClassName . '.proxy';
     $result = false;
     $src = $this->cache->fetch($cacheKey, $result);
     if (!$result) {
         $src = $this->createClass($proxyClassName, $dispatcher->getMethodsIntercepted(), $subject);
         $this->cache->store($cacheKey, $src);
     }
     eval($src);
     $proxyClassName::setDispatcher($dispatcher);
     $proxyClassName::setReflectionFactory($this->reflectionFactory);
     return $proxyClassName;
 }
Example #3
0
 /**
  * (non-PHPdoc)
  * @see Ding\Reflection.IReflectionFactory::getClassAnnotations()
  */
 public function getClassAnnotations($class)
 {
     if (!$this->_withAnnotations) {
         return array();
     }
     if (isset($this->_annotatedClasses[$class])) {
         return $this->_annotatedClasses[$class];
     }
     $cacheKey = $class . '.classannotations';
     $result = false;
     $annotations = $this->_cache->fetch($cacheKey, $result);
     if ($result === true) {
         $this->_annotatedClasses[$class] = $annotations;
         return $annotations;
     }
     $this->_annotatedClasses[$class] = array();
     $rClass = $this->getClass($class);
     $annotations = $this->_annotationParser->parse($rClass->getDocComment());
     $this->_populateClassesPerAnnotations($class, $annotations);
     $this->_annotatedClasses[$class] = $annotations;
     $this->_cache->store($cacheKey, $annotations);
     return $annotations;
 }