ApplicationCommand::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 8
nc 3
nop 2
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: nicolas
5
 * Date: 22/12/17
6
 * Time: 14:34
7
 */
8
9
namespace Devgiants\Model;
10
11
12
use Devgiants\Service\BackupTools;
13
use Monolog\Logger;
0 ignored issues
show
Bug introduced by
The type Monolog\Logger 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 Pimple\Container;
0 ignored issues
show
Bug introduced by
The type Pimple\Container 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
use Symfony\Component\Console\Command\Command;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Console\Command\Command 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...
16
17
abstract class ApplicationCommand extends Command {
18
	/**
19
	 * @var Container
20
	 */
21
	protected $container;
22
23
	/**
24
	 * @var Logger
25
	 */
26
	protected $log;
27
28
	/**
29
	 * @var BackupTools
30
	 */
31
	protected $tools;
32
33
	/**
34
	 * ApplicationCommand constructor.
35
	 *
36
	 * @param null|string $name
37
	 * @param Container $container
38
	 */
39
	public function __construct( $name, Container $container ) {
40
		$this->container = $container;
41
		parent::__construct( $name );
42
43
		// Initiates logging
44
		$this->log = $this->container['main_logger'];
45
		if ( ! $this->log instanceof Logger ) {
46
			throw new \InvalidArgumentException( "Container main_logger entry must be Logger type" );
47
		}
48
49
		$this->tools = $this->container['tools'];
50
		if ( ! $this->tools instanceof BackupTools ) {
51
			throw new \InvalidArgumentException( "Container tools entry must be BackupTool type" );
52
		}
53
	}
54
}