Exemplo n.º 1
0
 /**
  * @param string $name
  * @param Project $project
  * 
  * @return Command
  * 
  * @throws RuntimeException if project does not exists
  */
 public function getCommand($name, Project $project = null)
 {
     require_once $this->find($name);
     $class = sprintf('%s\\%s', $this->namespace, Helpers\pascal_case($name));
     $command = new $class($this->storage, $project, $this);
     return $command;
 }
Exemplo n.º 2
0
 /**
  * @return array
  */
 public function getProjectsList()
 {
     $files = scandir($this->projectsFolder);
     $projects = [];
     $apiCollection = new ApiCollection();
     foreach ($files as $file) {
         if (in_array($file, ['.', '..'])) {
             continue;
         }
         if (pathinfo($file, PATHINFO_EXTENSION) !== 'php') {
             continue;
         }
         $data = (require_once sprintf('%s/%s', $this->projectsFolder, $file));
         $class = Helpers\pascal_case(basename($file, '.php'));
         $projects[] = new $class($apiCollection);
     }
     return $projects;
 }