Platformsh\Cli\Command\Environment\EnvironmentRelationshipsCommand::execute PHP Метод

execute() защищенный Метод

protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->validateInput($input);
        $app = $this->selectApp($input);
        $environment = $this->getSelectedEnvironment();
        $cacheKey = implode('-', ['relationships', $environment->id . $environment->project . $app]);
        $cache = $this->api()->getCache();
        $relationships = $cache->fetch($cacheKey);
        if (empty($relationships) || $input->getOption('refresh')) {
            $util = new RelationshipsUtil($this->stdErr);
            $sshUrl = $environment->getSshUrl($app);
            $relationships = $util->getRelationships($sshUrl);
            if (empty($relationships)) {
                $this->stdErr->writeln('No relationships found');
                return 1;
            }
            $cache->save($cacheKey, $relationships, 3600);
        }
        $value = $relationships;
        $key = null;
        if ($property = $input->getOption('property')) {
            $parents = explode('.', $property);
            $key = end($parents);
            $value = Util::getNestedArrayValue($relationships, $parents, $keyExists);
            if (!$keyExists) {
                $this->stdErr->writeln("Relationship property not found: <error>{$property}</error>");
                return 1;
            }
        }
        $formatter = new PropertyFormatter();
        $formatter->yamlInline = 10;
        $output->writeln($formatter->format($value, $key));
        return 0;
    }
EnvironmentRelationshipsCommand