Completed
Push — try/capabilities ( 5ae69f )
by
unknown
53:59 queued 47:44
created

Builder::__construct()   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 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Automattic\Jetpack\Capabilities;
4
5
use \Automattic\Jetpack\Capabilities;
6
7
class Builder {
8
	// public $name;
9
	// public $available;
10
11
	function __construct() {
12
		$this->capabilities = new Capabilities();
0 ignored issues
show
Bug introduced by
The property capabilities does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
13
	}
14
	static function create() {
15
		return new Builder();
16
	}
17
18
	function require_wp_role( $wp_role ) {
19
		$this->capabilities->add_rule( new WPRoleRule( $wp_role ) );
20
		return $this;
21
	}
22
23
	function require_wp_capability( $wp_capability ) {
24
		$this->capabilities->add_rule( new WPCapabilityRule( $wp_capability ) );
25
		return $this;
26
	}
27
28
	/**
29
	 * For traditional Jetpack plans (free, personal, premium, professional ) this
30
	 * specifies the minimum plan required in required to perform the action
31
	 */
32
	function require_minimum_jetpack_plan( $jetpack_plan_level ) {
33
		// $this->capabilities->add_rule( new PlanRule( $wp_role ) );
34
		return $this;
35
	}
36
}
37