Skip to content

Commit 8c69822

Browse files
committed
Enable getting algo names
1 parent e98d4fc commit 8c69822

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

src/Algorithms/SignatureAlgorithmBag.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,20 @@ public function getAllInstances(): array
4747
$this->getAll(),
4848
);
4949
}
50+
51+
52+
/**
53+
* @return string[]
54+
*/
55+
public function getAllNamesUnique(): array
56+
{
57+
return array_unique(
58+
array_values(
59+
array_map(
60+
fn(SignatureAlgorithmEnum $signatureAlgorithmEnum): string => $signatureAlgorithmEnum->value,
61+
$this->getAll(),
62+
),
63+
),
64+
);
65+
}
5066
}

src/ValueAbstracts/SignatureKeyPairBag.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,20 @@ public function getFirstByAlgorithmOrFail(SignatureAlgorithmEnum $signatureAlgor
9292
),
9393
);
9494
}
95+
96+
97+
/**
98+
* @return string[]
99+
*/
100+
public function getAllAlgorithmNamesUnique(): array
101+
{
102+
return array_unique(
103+
array_values(
104+
array_map(
105+
fn(SignatureKeyPair $signatureKeyPair): string => $signatureKeyPair->getSignatureAlgorithm()->value,
106+
$this->getAll(),
107+
),
108+
),
109+
);
110+
}
95111
}

src/ValueAbstracts/SignatureKeyPairConfigBag.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,22 @@ public function getAll(): array
4545
{
4646
return $this->signatureKeyPairConfigs;
4747
}
48+
49+
50+
/**
51+
* @return string[]
52+
*/
53+
public function getAllAlgorithmNamesUnique(): array
54+
{
55+
return array_unique(
56+
array_values(
57+
array_map(
58+
fn(
59+
SignatureKeyPairConfig $signatureKeyPairConfig,
60+
): string => $signatureKeyPairConfig->getSignatureAlgorithm()->value,
61+
$this->getAll(),
62+
),
63+
),
64+
);
65+
}
4866
}

0 commit comments

Comments
 (0)