Skip to content

Commit 44b727a

Browse files
committed
feat(command): added php:info command
1 parent 58afe22 commit 44b727a

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

src/Command/Php/PhpInfoCommand.php

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* This file is part of Ymir command-line tool.
7+
*
8+
* (c) Carl Alexander <[email protected]>
9+
*
10+
* For the full copyright and license information, please view the LICENSE
11+
* file that was distributed with this source code.
12+
*/
13+
14+
namespace Ymir\Cli\Command\Php;
15+
16+
use Symfony\Component\Console\Input\InputInterface;
17+
use Symfony\Component\Console\Input\InputOption;
18+
use Ymir\Cli\Command\AbstractInvocationCommand;
19+
use Ymir\Cli\Console\OutputStyle;
20+
21+
class PhpInfoCommand extends AbstractInvocationCommand
22+
{
23+
/**
24+
* The name of the command.
25+
*
26+
* @var string
27+
*/
28+
public const NAME = 'php:info';
29+
30+
/**
31+
* {@inheritdoc}
32+
*/
33+
protected function configure()
34+
{
35+
$this
36+
->setName(self::NAME)
37+
->setDescription('Get information about PHP on the cloud provider')
38+
->addOption('environment', null, InputOption::VALUE_REQUIRED, 'The environment name', 'staging');
39+
}
40+
41+
/**
42+
* {@inheritdoc}
43+
*/
44+
protected function perform(InputInterface $input, OutputStyle $output)
45+
{
46+
$environment = (string) $this->getStringOption($input, 'environment');
47+
48+
$output->info(sprintf('Get information about PHP from the "<comment>%s</comment>" environment', $environment));
49+
50+
$result = $this->invokeEnvironmentFunction($environment, [
51+
'php' => '--info',
52+
]);
53+
54+
$output->newLine();
55+
$output->write("${result['output']}");
56+
57+
return $result['exitCode'];
58+
}
59+
}

0 commit comments

Comments
 (0)