1 | <?php |
||
19 | final class AlgorithmManager |
||
20 | { |
||
21 | /** |
||
22 | * @var array |
||
23 | */ |
||
24 | private $algorithms = []; |
||
25 | |||
26 | /** |
||
27 | * JWAManager constructor. |
||
28 | * |
||
29 | * @param AlgorithmInterface[] $algorithms |
||
30 | */ |
||
31 | private function __construct(array $algorithms) |
||
37 | |||
38 | /** |
||
39 | * @param AlgorithmInterface[] $algorithms |
||
40 | * |
||
41 | * @return AlgorithmManager |
||
42 | */ |
||
43 | public static function create(array $algorithms): AlgorithmManager |
||
47 | |||
48 | /** |
||
49 | * @param string $algorithm The algorithm |
||
50 | * |
||
51 | * @return bool Returns true if the algorithm is supported |
||
52 | */ |
||
53 | public function has(string $algorithm): bool |
||
57 | |||
58 | /** |
||
59 | * @return string[] Returns the list of names of supported algorithms |
||
60 | */ |
||
61 | public function list(): array |
||
65 | |||
66 | /** |
||
67 | * @param string $algorithm The algorithm |
||
68 | * |
||
69 | * @return AlgorithmInterface Returns JWAInterface object if the algorithm is supported, else null |
||
70 | */ |
||
71 | public function get(string $algorithm): AlgorithmInterface |
||
79 | |||
80 | /** |
||
81 | * @param AlgorithmInterface $algorithm |
||
82 | * |
||
83 | * @return AlgorithmManager |
||
84 | */ |
||
85 | private function add(AlgorithmInterface $algorithm): AlgorithmManager |
||
96 | } |
||
97 |