27 lines
695 B
PHP
27 lines
695 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace FecaMailshots\Infrastructure;
|
|
|
|
use FecaMailshots\Application\SecretKeyProvider;
|
|
|
|
final class WordPressSaltSecretKeyProvider implements SecretKeyProvider
|
|
{
|
|
public function keyMaterial(): string
|
|
{
|
|
$parts = [];
|
|
foreach (['AUTH_KEY', 'SECURE_AUTH_KEY', 'LOGGED_IN_KEY', 'NONCE_KEY'] as $const) {
|
|
if (defined($const) && is_string(constant($const)) && constant($const) !== '') {
|
|
$parts[] = constant($const);
|
|
}
|
|
}
|
|
|
|
if ($parts === []) {
|
|
throw new \RuntimeException('WordPress salt constants are not available.');
|
|
}
|
|
|
|
return implode('|', $parts);
|
|
}
|
|
}
|