[ 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\AuthenticationExtensions; 15 16 use ArrayIterator; 17 use Assert\Assertion; 18 use function count; 19 use Countable; 20 use Iterator; 21 use IteratorAggregate; 22 use JsonSerializable; 23 24 class AuthenticationExtensionsClientInputs implements JsonSerializable, Countable, IteratorAggregate 25 { 26 /** 27 * @var AuthenticationExtension[] 28 */ 29 private $extensions = []; 30 31 public function add(AuthenticationExtension $extension): void 32 { 33 $this->extensions[$extension->name()] = $extension; 34 } 35 36 public static function createFromArray(array $json): self 37 { 38 $object = new self(); 39 foreach ($json as $k => $v) { 40 $object->add(new AuthenticationExtension($k, $v)); 41 } 42 43 return $object; 44 } 45 46 public function has(string $key): bool 47 { 48 return \array_key_exists($key, $this->extensions); 49 } 50 51 /** 52 * @return mixed 53 */ 54 public function get(string $key) 55 { 56 Assertion::true($this->has($key), sprintf('The extension with key "%s" is not available', $key)); 57 58 return $this->extensions[$key]; 59 } 60 61 public function jsonSerialize(): array 62 { 63 return $this->extensions; 64 } 65 66 public function getIterator(): Iterator 67 { 68 return new ArrayIterator($this->extensions); 69 } 70 71 public function count(int $mode = COUNT_NORMAL): int 72 { 73 return \count($this->extensions, $mode); 74 } 75 }
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 |