Completed
Push — add/changelog-tooling ( 7f5585...86359e )
by
unknown
58:45 queued 48:46
created

PluginTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 46
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A instantiate() 0 3 1
A getOptions() 0 3 1
A setIO() 0 4 1
1
<?php // phpcs:ignore WordPress.Files.FileName.NotHyphenatedLowercase
2
/**
3
 * Trait for changelogger plugin boilerplate.
4
 *
5
 * @package automattic/jetpack-changelogger
6
 */
7
8
// phpcs:disable WordPress.NamingConventions.ValidFunctionName
9
10
namespace Automattic\Jetpack\Changelogger;
11
12
use Symfony\Component\Console\Input\InputInterface;
13
use Symfony\Component\Console\Input\InputOption;
14
use Symfony\Component\Console\Output\OutputInterface;
15
16
/**
17
 * Trait for changelogger plugin boilerplate.
18
 */
19
trait PluginTrait {
20
21
	/**
22
	 * InputInterface.
23
	 *
24
	 * @var InputInterface|null
25
	 */
26
	protected $input;
27
28
	/**
29
	 * OutputInterface.
30
	 *
31
	 * @var OutputInterface|null
32
	 */
33
	protected $output;
34
35
	/**
36
	 * Instantiate the plugin.
37
	 *
38
	 * @param array $config Configuration information from composer.json.
39
	 */
40
	public static function instantiate( array $config ) {
41
		return new static( $config );
0 ignored issues
show
Unused Code introduced by
The call to PluginTrait::__construct() has too many arguments starting with $config.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
42
	}
43
44
	/**
45
	 * Define any command line options the versioning plugin wants to accept.
46
	 *
47
	 * @return InputOption[]
48
	 */
49
	public function getOptions() {
50
		return array();
51
	}
52
53
	/**
54
	 * Set Symfony Console input and output interfaces.
55
	 *
56
	 * @param InputInterface  $input InputInterface.
57
	 * @param OutputInterface $output OutputInterface.
58
	 */
59
	public function setIO( InputInterface $input, OutputInterface $output ) {
60
		$this->input  = $input;
61
		$this->output = $output;
62
	}
63
64
}
65