Exemplo n.º 1
0
 /**
  * Get all classes for a namespace.
  *
  * @param string namespace
  * @return array
  */
 public function getClassesFromNamespace($namespace = null)
 {
     $base_namespace = $namespace ?: $this->getAppNamespace();
     $path = $this->stripNamespace($base_namespace, $this->getAppNamespace());
     $directory = app_path() . '\\' . $path;
     return $this->finder->findClasses($directory);
 }
Exemplo n.º 2
0
 /**
  * Get the cache contents for a given path.
  *
  * @param  string  $path
  * @return string
  */
 protected function getCacheForPath($path)
 {
     $cache = '';
     foreach ($this->finder->findClasses($path) as $class) {
         $cache .= $this->getCacheForClass(new ReflectionClass($class));
     }
     return $cache;
 }
Exemplo n.º 3
0
 /**
  * Parse config file and project to get all classes to extract.
  *
  *
  * @return array
  */
 public function getClasses()
 {
     $conf_classes = config('larinterface.classes');
     $conf_directories = config('larinterface.directories');
     $conf_ignore = config('larinterface.ignore');
     $classesArray = [];
     // Forge classes
     foreach ($conf_classes as $output => $classes) {
         if (is_numeric($output)) {
             $output = 0;
         }
         if (is_string($classes)) {
             $classes = [$classes];
         }
         if (isset($classesArray[$output])) {
             $classesArray[$output] = array_merge($classesArray[$output], $classes);
         } else {
             $classesArray[$output] = $classes;
         }
     }
     // Forge directories
     foreach ($conf_directories as $output => $directories) {
         if (is_numeric($output)) {
             $output = 0;
         }
         if (is_string($directories)) {
             $directories = [$directories];
         }
         foreach ($directories as $directory) {
             $classes = $this->classFinder->findClasses(base_path($directory));
             if (isset($classesArray[$output])) {
                 $classesArray[$output] = array_merge($classesArray[$output], $classes);
             } else {
                 $classesArray[$output] = $classes;
             }
         }
     }
     // Clean forged class
     foreach ($classesArray as $key => $value) {
         // Ignore files
         foreach ($conf_ignore as $class) {
             $classKey = array_search($class, $value);
             if ($classKey !== false) {
                 unset($value[$classKey]);
             }
         }
         $classesArray[$key] = array_unique($value);
     }
     return $this->classes = $this->extractInterfacePathFromClasses($classesArray);
 }
Exemplo n.º 4
0
 /**
  * Get all classes for a given namespace.
  *
  * @param string $namespace
  * @return array
  */
 public function getClassesFromNamespace($namespace = null)
 {
     $namespace = $namespace ?: $this->getAppNamespace();
     $path = $this->convertNamespaceToPath($namespace);
     return $this->finder->findClasses($path);
 }
Exemplo n.º 5
0
 /**
  * Search the app path for any models that implement EloquentJs.
  *
  * @return array
  */
 protected function searchAppForModels()
 {
     return array_filter($this->classFinder->findClasses(app_path()), function ($className) {
         return $this->isEloquentJsModel($className);
     });
 }