public function getCurrentProject()
    {
        if (isset($this->currentProject)) {
            return $this->currentProject;
        }
        if (!$projectRoot = $this->getProjectRoot()) {
            return false;
        }

        $project = false;
        /** @var \Platformsh\Cli\Local\LocalProject $localProject */
        $localProject = $this->getService('local.project');
        $config = $localProject->getProjectConfig($projectRoot);
        if ($config) {
            $project = $this->api()->getProject($config['id'], isset($config['host']) ? $config['host'] : null);
            if (!$project) {
                throw new ProjectNotFoundException(
                    "Project not found: " . $config['id']
                    . "\nEither you do not have access to the project or it no longer exists."
                );
            }
            $this->debug('Project ' . $config['id'] . ' is mapped to the current directory');
        }
        $this->currentProject = $project;

        return $project;
    }
public function getCurrentProject()
    {
        if (isset($this->currentProject)) {
            return $this->currentProject;
        }
        if (!$projectRoot = $this->getProjectRoot()) {
            return false;
        }

        $project = false;
        /** @var \Platformsh\Cli\Local\LocalProject $localProject */
        $localProject = $this->getService('local.project');
        $config = $localProject->getProjectConfig($projectRoot);
        if ($config) {
            $project = $this->api()->getProject($config['id'], isset($config['host']) ? $config['host'] : null);
            if (!$project) {
                throw new ProjectNotFoundException(
                    "Project not found: " . $config['id']
                    . "\nEither you do not have access to the project or it no longer exists."
                );
            }
            $this->debug('Project ' . $config['id'] . ' is mapped to the current directory');
        }
        $this->currentProject = $project;

        return $project;
    }
public function getCurrentProject ( ) { if ( isset ( $ this -> currentProject ) ) { return $ this -> currentProject ; } if ( ! $ projectRoot = $ this -> getProjectRoot ( ) ) { return false ; } $ project = false ; /** @var \Platformsh\Cli\Local\LocalProject $localProject */ $ localProject = $ this -> getService ( 'local.project' ) ; $ config = $ localProject -> getProjectConfig ( $ projectRoot ) ; if ( $ config ) { $ project = $ this -> api ( ) -> getProject ( $ config [ 'id' ] , isset ( $ config [ 'host' ] ) ? $ config [ 'host' ] : null ) ; if ( ! $ project ) { throw new ProjectNotFoundException ( "Project not found: " . $ config [ 'id' ] . "\nEither you do not have access to the project or it no longer exists." ) ; } $ this -> debug ( 'Project ' . $ config [ 'id' ] . ' is mapped to the current directory' ) ; } $ this -> currentProject = $ project ; return $ project ; }
Get the current project if the user is in a project directory.

@throws \RuntimeException

@return Project|false The current project
Get the current project if the user is in a project directory .