Completed
Push — try/capabilities ( 1eedd1...45f305 )
by
unknown
06:43
created

AggregateRule   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A add_rule() 0 3 1
A register() 0 3 1
1
<?php
2
/**
3
 * Interface that describes a rule object which, when checked, returns a permission that indicates if the rule passed or failed
4
 *
5
 * @package automattic/jetpack-capabilities
6
 */
7
8
namespace Automattic\Jetpack\Capabilities;
9
10
use Automattic\Jetpack\Capabilities;
11
12
// phpcs:ignore Squiz.Commenting.ClassComment.Missing
13
abstract class AggregateRule implements Rule {
14
	/**
15
	 * The set of rules used to evaluate if permission is granted
16
	 *
17
	 * @var array rules
18
	 */
19
	protected $rules;
20
21
	// phpcs:ignore Squiz.Commenting.FunctionComment.Missing
22
	public function __construct() {
23
		$this->rules = [];
24
	}
25
26
	// phpcs:ignore Squiz.Commenting.FunctionComment.Missing
27
	public function add_rule( $rule ) {
28
		$this->rules[] = $rule;
29
	}
30
31
	// phpcs:ignore Squiz.Commenting.FunctionComment.Missing
32
	public function register( $name ) {
33
		Capabilities::register( $this, $name );
34
	}
35
}
36