Completed
Push — try/capabilities ( eb7fe7...7f65a9 )
by
unknown
40:05 queued 32:52
created

Capabilities::add_rule()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Automattic\Jetpack;
4
5
use \Automattic\Jetpack\Capabilities\Capability;
6
7
const JETPACK_BUSINESS_PLAN_SLUG = 'jetpack_business';
8
9
class Capabilities {
10
	private $capabilities;
11
12
	function __construct() {
13
		$this->capabilities = [];
14
	}
15
16
	static function get( $name ) {
17
		return new Capability( $name, $this );
0 ignored issues
show
Bug introduced by
The variable $this does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
Unused Code introduced by
The call to Capability::__construct() has too many arguments starting with $this.

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...
18
	}
19
20
	public function register( $capability ) {
21
		// TODO check for clashes?
22
		$this->capabilities[ $capability->name ] = $capability;
23
	}
24
}
25