WorkflowGeneratorCommand   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 68
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getStub() 0 4 1
A __construct() 0 11 1
A getWorkflowName() 0 6 1
A getArguments() 0 6 1
1
<?php namespace Cerbero\Workflow\Console\Commands;
2
3
use Illuminate\Filesystem\Filesystem;
4
use Illuminate\Console\GeneratorCommand;
5
use Symfony\Component\Console\Input\InputArgument;
6
use Cerbero\Workflow\Inflectors\InflectorInterface;
7
use Cerbero\Workflow\Repositories\PipelineRepositoryInterface;
8
9
/**
10
 * Abstract implementation of a workflow generator.
11
 *
12
 * @author	Andrea Marco Sartori
13
 */
14
abstract class WorkflowGeneratorCommand extends GeneratorCommand {
15
16
	/**
17
	 * @author	Andrea Marco Sartori
18
	 * @var		Cerbero\Workflow\Repositories\PipelineRepositoryInterface	$pipelines	Pipeline repository.
19
	 */
20
	protected $pipelines;
21
22
	/**
23
	 * @author	Andrea Marco Sartori
24
	 * @var		Cerbero\Workflow\Inflectors\InflectorInterface	$inflector	Inflector.
25
	 */
26
	protected $inflector;
27
28
	/**
29
	 * Set the dependencies.
30
	 *
31
	 * @param  \Illuminate\Filesystem\Filesystem  $files
32
	 * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
33
	 */
34
	public function __construct(
35
		Filesystem $files,
36
		PipelineRepositoryInterface $pipelines,
37
		InflectorInterface $inflector
38
	) {
39
		parent::__construct($files);
40
41
		$this->pipelines = $pipelines;
0 ignored issues
show
Documentation Bug introduced by
It seems like $pipelines of type object<Cerbero\Workflow\...ineRepositoryInterface> is incompatible with the declared type object<Cerbero\Workflow\...ineRepositoryInterface> of property $pipelines.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
42
43
		$this->inflector = $inflector;
0 ignored issues
show
Documentation Bug introduced by
It seems like $inflector of type object<Cerbero\Workflow\...ors\InflectorInterface> is incompatible with the declared type object<Cerbero\Workflow\...ors\InflectorInterface> of property $inflector.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
44
	}
45
46
	/**
47
	 * Get the stub file for the generator.
48
	 *
49
	 * @return string
50
	 */
51
	protected function getStub()
52
	{
53
		return __DIR__ . '/../Stubs/pipe.stub';
54
	}
55
56
	/**
57
	 * Retrieve the name of the workflow.
58
	 *
59
	 * @author	Andrea Marco Sartori
60
	 * @return	string
61
	 */
62
	protected function getWorkflowName()
63
	{
64
		$name = $this->argument('name');
65
66
		return ucfirst($name);
67
	}
68
69
	/**
70
	 * Get the console command arguments.
71
	 *
72
	 * @return array
73
	 */
74
	protected function getArguments()
75
	{
76
		return [
77
			['name', InputArgument::REQUIRED, 'The name of the workflow.'],
78
		];
79
	}
80
81
}
82