| @@ 24-73 (lines=50) @@ | ||
| 21 | use JsonSerializable; |
|
| 22 | use Surfnet\Stepup\Exception\InvalidArgumentException; |
|
| 23 | ||
| 24 | class SelectRaaOption implements JsonSerializable |
|
| 25 | { |
|
| 26 | /** |
|
| 27 | * @var string[]|null |
|
| 28 | */ |
|
| 29 | private $selectRaaOption; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * SelectRaaOption constructor. |
|
| 33 | * @param string[]|null $selectRaaOption |
|
| 34 | */ |
|
| 35 | public function __construct($selectRaaOption) |
|
| 36 | { |
|
| 37 | if (!is_null($selectRaaOption) && !is_array($selectRaaOption)) { |
|
| 38 | throw InvalidArgumentException::invalidType( |
|
| 39 | 'null or string[]', |
|
| 40 | 'selectRaaOption', |
|
| 41 | $selectRaaOption |
|
| 42 | ); |
|
| 43 | } |
|
| 44 | ||
| 45 | $this->selectRaaOption = $selectRaaOption; |
|
| 46 | ||
| 47 | // Sort the array values alphabetically |
|
| 48 | if (is_array($this->selectRaaOption)) { |
|
| 49 | sort($this->selectRaaOption); |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||
| 53 | public static function getDefault() |
|
| 54 | { |
|
| 55 | return new self(null); |
|
| 56 | } |
|
| 57 | ||
| 58 | public function getSelectRaaOption() |
|
| 59 | { |
|
| 60 | return $this->selectRaaOption; |
|
| 61 | } |
|
| 62 | ||
| 63 | public function equals(SelectRaaOption $other) |
|
| 64 | { |
|
| 65 | return $this->getSelectRaaOption() === $other->getSelectRaaOption(); |
|
| 66 | } |
|
| 67 | ||
| 68 | public function jsonSerialize() |
|
| 69 | { |
|
| 70 | return $this->getSelectRaaOption(); |
|
| 71 | } |
|
| 72 | } |
|
| 73 | ||
| @@ 24-73 (lines=50) @@ | ||
| 21 | use JsonSerializable; |
|
| 22 | use Surfnet\Stepup\Exception\InvalidArgumentException; |
|
| 23 | ||
| 24 | class UseRaaOption implements JsonSerializable |
|
| 25 | { |
|
| 26 | /** |
|
| 27 | * @var string[]|null |
|
| 28 | */ |
|
| 29 | private $useRaaOption; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * UseRaaOption constructor. |
|
| 33 | * @param string[]|null $useRaaOption |
|
| 34 | */ |
|
| 35 | public function __construct($useRaaOption) |
|
| 36 | { |
|
| 37 | if (!is_null($useRaaOption) && !is_array($useRaaOption)) { |
|
| 38 | throw InvalidArgumentException::invalidType( |
|
| 39 | 'null or string[]', |
|
| 40 | 'useRaaOption', |
|
| 41 | $useRaaOption |
|
| 42 | ); |
|
| 43 | } |
|
| 44 | ||
| 45 | $this->useRaaOption = $useRaaOption; |
|
| 46 | ||
| 47 | // Sort the array values alphabetically |
|
| 48 | if (is_array($this->useRaaOption)) { |
|
| 49 | sort($this->useRaaOption); |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||
| 53 | public static function getDefault() |
|
| 54 | { |
|
| 55 | return new self(null); |
|
| 56 | } |
|
| 57 | ||
| 58 | public function getUseRaaOption() |
|
| 59 | { |
|
| 60 | return $this->useRaaOption; |
|
| 61 | } |
|
| 62 | ||
| 63 | public function equals(UseRaaOption $other) |
|
| 64 | { |
|
| 65 | return $this->getUseRaaOption() === $other->getUseRaaOption(); |
|
| 66 | } |
|
| 67 | ||
| 68 | public function jsonSerialize() |
|
| 69 | { |
|
| 70 | return $this->getUseRaaOption(); |
|
| 71 | } |
|
| 72 | } |
|
| 73 | ||
| @@ 24-74 (lines=51) @@ | ||
| 21 | use JsonSerializable; |
|
| 22 | use Surfnet\Stepup\Exception\InvalidArgumentException; |
|
| 23 | ||
| 24 | class UseRaOption implements JsonSerializable |
|
| 25 | { |
|
| 26 | /** |
|
| 27 | * @var string[]|null |
|
| 28 | */ |
|
| 29 | private $useRaOption; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * UseRaOption constructor. |
|
| 33 | * @param null|array $useRaOption |
|
| 34 | */ |
|
| 35 | public function __construct($useRaOption) |
|
| 36 | { |
|
| 37 | if (!is_null($useRaOption) && !is_array($useRaOption)) { |
|
| 38 | throw InvalidArgumentException::invalidType( |
|
| 39 | 'null or string[]', |
|
| 40 | 'useRaOption', |
|
| 41 | $useRaOption |
|
| 42 | ); |
|
| 43 | ||
| 44 | } |
|
| 45 | ||
| 46 | $this->useRaOption = $useRaOption; |
|
| 47 | ||
| 48 | // Sort the array values alphabetically |
|
| 49 | if (is_array($this->useRaOption)) { |
|
| 50 | sort($this->useRaOption); |
|
| 51 | } |
|
| 52 | } |
|
| 53 | ||
| 54 | public static function getDefault() |
|
| 55 | { |
|
| 56 | return new self(null); |
|
| 57 | } |
|
| 58 | ||
| 59 | public function equals(UseRaOption $other) |
|
| 60 | { |
|
| 61 | return $this->getUseRaOption() === $other->getUseRaOption(); |
|
| 62 | } |
|
| 63 | ||
| 64 | public function getUseRaOption() |
|
| 65 | { |
|
| 66 | return $this->useRaOption; |
|
| 67 | } |
|
| 68 | ||
| 69 | public function jsonSerialize() |
|
| 70 | { |
|
| 71 | return $this->getUseRaOption(); |
|
| 72 | } |
|
| 73 | } |
|
| 74 | ||