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

Builder::get_capability()   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 $capability;
9
10
	function create_capability( $name ) {
11
		$this->capability = new Capability( $name );
12
		return $this;
13
	}
14
15
	function get_capability() {
16
		return $this->capability;
17
	}
18
19
	function require_wp_role( $wp_role ) {
20
		$this->capability->add_rule( new WPRoleRule( $wp_role ) );
21
		return $this;
22
	}
23
24
	function require_wp_capability( $wp_capability ) {
25
		$this->capability->add_rule( new WPCapabilityRule( $wp_capability ) );
26
		return $this;
27
	}
28
29
	/**
30
	 * For traditional Jetpack plans (free, personal, premium, professional ) this
31
	 * specifies the minimum plan required in required to perform the action
32
	 */
33
	function require_minimum_jetpack_plan( $jetpack_plan_level ) {
34
		$this->capability->add_rule( new PlanRule( $wp_role ) );
0 ignored issues
show
Bug introduced by
The variable $wp_role 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...
35
		return $this;
36
	}
37
38
	/**
39
	 * Register a capability globally
40
	 */
41
	function register() {
42
		Capabilities::register( $capability );
0 ignored issues
show
Bug introduced by
The variable $capability 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...
43
	}
44
}
45