| Total Complexity | 4 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | abstract class AbstractProxies extends AbstractCasElement |
||
| 18 | { |
||
| 19 | final public const string LOCALNAME = 'proxies'; |
||
|
|
|||
| 20 | |||
| 21 | |||
| 22 | /** |
||
| 23 | * Initialize a Proxies element. |
||
| 24 | * |
||
| 25 | * @param \SimpleSAML\CAS\XML\Proxy[] $proxy |
||
| 26 | */ |
||
| 27 | public function __construct( |
||
| 28 | protected array $proxy = [], |
||
| 29 | ) { |
||
| 30 | Assert::maxCount($proxy, C::UNBOUNDED_LIMIT); |
||
| 31 | Assert::allIsInstanceOf($proxy, Proxy::class); |
||
| 32 | Assert::minCount($proxy, 1, 'Missing at least one Proxy in Proxies.', MissingElementException::class); |
||
| 33 | } |
||
| 34 | |||
| 35 | |||
| 36 | /** |
||
| 37 | * @return \SimpleSAML\CAS\XML\Proxy[] |
||
| 38 | */ |
||
| 39 | public function getProxy(): array |
||
| 40 | { |
||
| 41 | return $this->proxy; |
||
| 42 | } |
||
| 43 | |||
| 44 | |||
| 45 | /** |
||
| 46 | * Convert this Proxies to XML. |
||
| 47 | * |
||
| 48 | * @param \DOMElement|null $parent The element we should append this Proxies to. |
||
| 49 | * @return \DOMElement |
||
| 50 | */ |
||
| 51 | public function toXML(?DOMElement $parent = null): DOMElement |
||
| 52 | { |
||
| 53 | $e = $this->instantiateParentElement($parent); |
||
| 54 | |||
| 55 | foreach ($this->getProxy() as $proxy) { |
||
| 56 | $proxy->toXML($e); |
||
| 57 | } |
||
| 58 | |||
| 59 | return $e; |
||
| 60 | } |
||
| 61 | } |
||
| 62 |