Completed
Push — try/capabilities ( 7f65a9...672273 )
by
unknown
19:16 queued 12:21
created

PermissionDenied   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A granted() 0 3 1
A message() 0 3 1
A data() 0 3 1
1
<?php
2
/**
3
 * A convenience class representing a permission which has been denied, along with an error message
4
 *
5
 * @package automattic/jetpack-capabilities
6
 */
7
8
namespace Automattic\Jetpack\Capabilities;
9
10
// phpcs:ignore Squiz.Commenting.ClassComment.Missing
11
class PermissionDenied implements Permission {
12
	/**
13
	 * A user-facing error message
14
	 *
15
	 * @var string error_message
16
	 */
17
	private $error_message;
18
19
	// phpcs:ignore Squiz.Commenting.FunctionComment.Missing
20
	public function __construct( $error_message ) {
21
		$this->error_message = $error_message;
22
	}
23
24
	// phpcs:ignore Squiz.Commenting.FunctionComment.Missing
25
	public function granted() {
26
		return false;
27
	}
28
29
	// phpcs:ignore Squiz.Commenting.FunctionComment.Missing
30
	public function message() {
31
		return $this->error_message;
32
	}
33
34
	// phpcs:ignore Squiz.Commenting.FunctionComment.Missing
35
	public function data() {
36
		return null;
37
	}
38
}
39