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

AggregateRule::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
 * 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