Platformsh\Cli\Command\CommandBase::getProjectRoot PHP Метод

getProjectRoot() публичный Метод

public getProjectRoot ( ) : string | false
Результат string | false
    public function getProjectRoot()
    {
        if (!isset(self::$projectRoot)) {
            $this->debug('Finding the project root based on the CWD');
            self::$projectRoot = $this->localProject->getProjectRoot();
            $this->debug(self::$projectRoot ? 'Project root found: ' . self::$projectRoot : 'Project root not found');
        }
        return self::$projectRoot;
    }

Usage Example

 /**
  * Get a list of application names in the local project.
  *
  * @return string[]
  */
 public function getAppNames()
 {
     $apps = [];
     if ($projectRoot = $this->welcomeCommand->getProjectRoot()) {
         foreach (LocalApplication::getApplications($projectRoot) as $app) {
             $name = $app->getName();
             if ($name !== null) {
                 $apps[] = $name;
             }
         }
     }
     return $apps;
 }