Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
6 / 6 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
| AuthorizationResponse | |
100.00% |
6 / 6 |
|
100.00% |
4 / 4 |
4 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| getMessage | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getSkipped | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getAuthorizationsApplied | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Drupal\authorization; |
| 6 | |
| 7 | /** |
| 8 | * Response object for the output of grantsAndRevokes(). |
| 9 | */ |
| 10 | class AuthorizationResponse { |
| 11 | |
| 12 | /** |
| 13 | * Label of authorization message plus optional information (e.g. skipped). |
| 14 | * |
| 15 | * @var string |
| 16 | */ |
| 17 | private $message; |
| 18 | |
| 19 | /** |
| 20 | * Whether the profile was skipped outright. |
| 21 | * |
| 22 | * @var bool |
| 23 | */ |
| 24 | private $skipped; |
| 25 | |
| 26 | /** |
| 27 | * Any authorizations applied. |
| 28 | * |
| 29 | * @var array |
| 30 | */ |
| 31 | private $authorizationsApplied = []; |
| 32 | |
| 33 | /** |
| 34 | * AuthorizationResponse constructor. |
| 35 | * |
| 36 | * @param string $message |
| 37 | * Message. |
| 38 | * @param bool $skipped |
| 39 | * Authorization skipped. |
| 40 | * @param array $authorizations_applied |
| 41 | * Authorizations applied. |
| 42 | */ |
| 43 | public function __construct(string $message, bool $skipped, array $authorizations_applied) { |
| 44 | $this->message = $message; |
| 45 | $this->skipped = $skipped; |
| 46 | $this->authorizationsApplied = $authorizations_applied; |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Get the message. |
| 51 | * |
| 52 | * @return string |
| 53 | * The message. |
| 54 | */ |
| 55 | public function getMessage(): string { |
| 56 | return $this->message; |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * If the authorization was skipped. |
| 61 | * |
| 62 | * @return bool |
| 63 | * If skipped. |
| 64 | */ |
| 65 | public function getSkipped(): bool { |
| 66 | return $this->skipped; |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * The authorizations applied. |
| 71 | * |
| 72 | * @return array |
| 73 | * Authorizations. |
| 74 | */ |
| 75 | public function getAuthorizationsApplied(): array { |
| 76 | return $this->authorizationsApplied; |
| 77 | } |
| 78 | |
| 79 | } |