[ 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-2020 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 Jose\Component\Signature\Serializer; 15 16 use InvalidArgumentException; 17 18 class JWSSerializerManagerFactory 19 { 20 /** 21 * @var JWSSerializer[] 22 */ 23 private $serializers = []; 24 25 /** 26 * @param string[] $names 27 * 28 * @throws InvalidArgumentException if the serializer is not supported 29 */ 30 public function create(array $names): JWSSerializerManager 31 { 32 $serializers = []; 33 foreach ($names as $name) { 34 if (!isset($this->serializers[$name])) { 35 throw new InvalidArgumentException(sprintf('Unsupported serializer "%s".', $name)); 36 } 37 $serializers[] = $this->serializers[$name]; 38 } 39 40 return new JWSSerializerManager($serializers); 41 } 42 43 /** 44 * @return string[] 45 */ 46 public function names(): array 47 { 48 return array_keys($this->serializers); 49 } 50 51 /** 52 * @return JWSSerializer[] 53 */ 54 public function all(): array 55 { 56 return $this->serializers; 57 } 58 59 public function add(JWSSerializer $serializer): void 60 { 61 $this->serializers[$serializer->name()] = $serializer; 62 } 63 }
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 |