Issues (97)

src/Console/BaseCommand.php (2 issues)

Labels
Severity
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: joshgulledge
5
 * Date: 2/15/18
6
 * Time: 2:21 PM
7
 */
8
9
namespace LCI\Blend\Console;
10
11
use modX;
0 ignored issues
show
The type modX 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 LCI\Blend\Blender;
13
use LCI\MODX\Console\Command\BaseCommand as Command;
14
use Symfony\Component\Console\Input\InputInterface;
15
use Symfony\Component\Console\Output\OutputInterface;
16
17
/**
18
 * Class BaseCommand
19
 *
20
 * @package LCI\Blend\Console\BaseCommand
21
 */
22
abstract class BaseCommand extends Command
23
{
24
    /** @var \modX $modx */
25
    protected $modx;
26
27
    /** @var \LCI\Blend\Blender */
28
    protected $blender;
29
30
    protected $loadMODX = true;
31
32
    /**
33
     * Initializes the command just after the input has been validated.
34
     *
35
     * This is mainly useful when a lot of commands extends one main command
36
     * where some things need to be initialized based on the input arguments and options.
37
     *
38
     * @param InputInterface  $input  An InputInterface instance
39
     * @param OutputInterface $output An OutputInterface instance
40
     */
41
    public function initialize(InputInterface $input, OutputInterface $output)
42
    {
43
        parent::initialize($input, $output);
44
45
        if ($this->loadMODX) {
46
            $this->modx = $this->console->loadMODX();
47
            $local_migration_path = getenv('BLEND_LOCAL_MIGRATION_PATH');
48
            if (!$local_migration_path) {
49
                $local_migration_path = MODX_CORE_PATH.'components/blend/';
0 ignored issues
show
The constant LCI\Blend\Console\MODX_CORE_PATH was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
50
            }
51
52
            $this->blender = new Blender(
53
                $this->modx,
54
                $this->consoleUserInteractionHandler,
55
                [
56
                    'blend_modx_migration_dir' => $local_migration_path,
57
                ]
58
            );
59
60
            $this->blender->setVerbose($output->getVerbosity());
61
        }
62
    }
63
}
64