Issues (108)

src/Command/RunCommand.php (5 issues)

Labels
Severity
1
<?php
2
3
/**
4
 * @copyright Bluz PHP Team
5
 * @link https://github.com/bluzphp/bluzman
6
 */
7
8
namespace Bluzman\Command;
9
10
use Application\CliBootstrap;
0 ignored issues
show
The type Application\CliBootstrap was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Symfony\Component\Console\Input\InputArgument;
0 ignored issues
show
The type Symfony\Component\Console\Input\InputArgument was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use Symfony\Component\Console\Input\InputInterface;
0 ignored issues
show
The type Symfony\Component\Console\Input\InputInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use Symfony\Component\Console\Input\InputOption;
0 ignored issues
show
The type Symfony\Component\Console\Input\InputOption was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use Symfony\Component\Console\Output\OutputInterface;
0 ignored issues
show
The type Symfony\Component\Console\Output\OutputInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
16
/**
17
 * Class List command
18
 *
19
 * @package Bluzman\Command
20
 *
21
 * @author   Pavel Machekhin
22
 * @created  2013-03-28 14:03
23
 */
24
class RunCommand extends AbstractCommand
25
{
26
    /**
27
     * Command configuration
28 15
     */
29
    protected function configure()
30
    {
31
        $this
32 15
            // the name of the command (the part after "bin/bluzman")
33
            ->setName('run')
34 15
            // the short description shown while running "php bin/bluzman list"
35
            ->setDescription('Run controller')
36
            // the full command description shown when running the command with
37 15
            // the "--help" option
38
            ->setHelp('Run specified controller with options params')
39
        ;
40 15
41 15
        $uri = new InputArgument(
42 15
            'uri',
43 15
            InputArgument::REQUIRED,
44
            'URI to call'
45
        );
46 15
47
        $this->getDefinition()->addArgument($uri);
48
49 15
50 15
        $debug = new InputOption(
51 15
            '--debug',
52 15
            '-d',
53 15
            InputOption::VALUE_NONE,
54
            'Display debug information'
55
        );
56 15
57 15
        $this->getDefinition()->addOption($debug);
58
    }
59
60
    /**
61
     * @param InputInterface  $input
62
     * @param OutputInterface $output
63
     *
64
     * @return int
65
     */
66
    protected function execute(InputInterface $input, OutputInterface $output): int
67
    {
68
        if ($input->getOption('debug')) {
69
            error_reporting(E_ALL);
70
            ini_set('display_errors', 1);
71
        }
72
        $app = CliBootstrap::getInstance();
73
        $app->setInput($input);
74
        $app->setOutput($output);
75
        $app->init($input->getOption('env'));
76
        $app->run();
77
        return 0;
78
    }
79
}
80