Platformsh\Cli\Local\LocalApplication::getConfig PHP Method

getConfig() public method

Get the application's configuration, parsed from its YAML definition.
public getConfig ( ) : array
return array
    public function getConfig()
    {
        if (!isset($this->config)) {
            $this->config = [];
            $file = $this->appRoot . '/' . $this->cliConfig->get('service.app_config_file');
            if (file_exists($file)) {
                try {
                    $parser = new Parser();
                    $config = (array) $parser->parse(file_get_contents($file));
                    $this->config = $this->normalizeConfig($config);
                } catch (ParseException $e) {
                    throw new InvalidConfigException("Parse error in file '{$file}': \n" . $e->getMessage());
                }
            }
        }
        return $this->config;
    }

Usage Example

 public function testGetAppConfigNested()
 {
     $fakeAppRoot = 'tests/data/repositories/multiple/nest/nested';
     $app = new LocalApplication($fakeAppRoot);
     $config = $app->getConfig();
     $this->assertEquals(['name' => 'nested1'], $config);
     $this->assertEquals('nested1', $app->getName());
     $this->assertEquals('nested1', $app->getId());
 }
All Usage Examples Of Platformsh\Cli\Local\LocalApplication::getConfig