/**
  * @param AnnotationManager $annotationManager
  * @param ServiceManager    $serviceManager
  * @param RouteManager      $routeManager
  * @param Standard          $prettyPrinter
  */
 public function updateCache(AnnotationManager $annotationManager, ServiceManager $serviceManager, RouteManager $routeManager, Standard $prettyPrinter)
 {
     $classInfos = $annotationManager->buildClassInfosBasedOnPaths($this->paths);
     $code = "<?php\n\n";
     foreach ($classInfos as $classInfo) {
         $code .= $prettyPrinter->prettyPrint($serviceManager->generateCode($classInfo));
         $code .= "\n\n";
     }
     foreach ($classInfos as $classInfo) {
         $code .= $prettyPrinter->prettyPrint($routeManager->generateCode($classInfo));
         $code .= "\n\n";
     }
     file_put_contents($this->cacheFile, $code);
 }
예제 #2
0
 /**
  * Returns all classes information inside Zeus initial directory
  * configured at zeus.json
  * @return \Saxulum\AnnotationManager\Helper\ClassInfo
  */
 private function getAllClasses()
 {
     $annotationReader = new SimpleAnnotationReader();
     $annotationManager = new AnnotationManager($annotationReader);
     $zConf = Configuration::getInstance();
     return $annotationManager->buildClassInfosBasedOnPath($zConf->getInitialDirectory());
 }
 public function testFindClassesWithinAFile()
 {
     $classes = AnnotationManager::findClassesWithinAFile(new SplFileInfo(dirname(__DIR__) . '/Classes1/TestClass1.php', '', 'TestClass1.php'));
     $this->assertCount(1, $classes);
     $this->assertEquals('Saxulum\\Tests\\AnnotationManager\\Classes1\\TestClass1', $classes[0]);
 }