[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 declare(strict_types=1); 4 5 /* 6 * The MIT License (MIT) 7 * 8 * Copyright (c) 2014-2019 Spomky-Labs 9 * 10 * This software may be modified and distributed under the terms 11 * of the MIT license. See the LICENSE file for details. 12 */ 13 14 namespace Webauthn\TrustPath; 15 16 use Assert\Assertion; 17 use InvalidArgumentException; 18 19 abstract class TrustPathLoader 20 { 21 public static function loadTrustPath(array $data): TrustPath 22 { 23 Assertion::keyExists($data, 'type', 'The trust path type is missing'); 24 $type = $data['type']; 25 $oldTypes = self::oldTrustPathTypes(); 26 switch (true) { 27 case \array_key_exists($type, $oldTypes): 28 return $oldTypes[$type]::createFromArray($data); 29 case class_exists($type): 30 $implements = class_implements($type); 31 if (\is_array($implements) && \in_array(TrustPath::class, $implements, true)) { 32 return $type::createFromArray($data); 33 } 34 // no break 35 default: 36 throw new InvalidArgumentException(sprintf('The trust path type "%s" is not supported', $data['type'])); 37 } 38 } 39 40 private static function oldTrustPathTypes(): array 41 { 42 return [ 43 'empty' => EmptyTrustPath::class, 44 'ecdaa_key_id' => EcdaaKeyIdTrustPath::class, 45 'x5c' => CertificateTrustPath::class, 46 ]; 47 } 48 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |