php syntax corrections
This commit is contained in:
1 parent
9ff09693ed
commit
b1284f6fa9
3 files changed
+43
No files matched your search
@@ -28,6 +28,45 @@ abstract class AbstractPasswordGenerator implements PasswordGeneratorInterface
|
||||
$this->loadConfiguration();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the configured logger should emit a message at the requested level.
|
||||
*/
|
||||
protected function isLogLevel(string $level): bool
|
||||
{
|
||||
if ($this->logger === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$normalizedLevel = strtolower(trim($level));
|
||||
if ($normalizedLevel === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (method_exists($this->logger, 'isHandling')) {
|
||||
$reflection = new \ReflectionMethod($this->logger, 'isHandling');
|
||||
if ($reflection->isPublic()) {
|
||||
return (bool) $reflection->invoke($this->logger, $normalizedLevel);
|
||||
}
|
||||
}
|
||||
|
||||
$configuredLevel = strtolower((string) $this->getConfigValue('logging.level', 'warning'));
|
||||
$levels = [
|
||||
'debug' => 0,
|
||||
'info' => 1,
|
||||
'notice' => 2,
|
||||
'warning' => 3,
|
||||
'error' => 4,
|
||||
'critical' => 5,
|
||||
'alert' => 6,
|
||||
'emergency' => 7,
|
||||
];
|
||||
|
||||
$requested = $levels[$normalizedLevel] ?? $levels['warning'];
|
||||
$threshold = $levels[$configuredLevel] ?? $levels['warning'];
|
||||
|
||||
return $requested >= $threshold;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load configuration from config/config.json.
|
||||
*/
|
||||
|
||||
@@ -4,7 +4,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Generators;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
use App\Services\Logging\LoggingHelper;
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,9 @@ declare(strict_types=1);
|
||||
namespace App\Generators;
|
||||
|
||||
use App\Services\LLM\LLMManager;
|
||||
use InvalidArgumentException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user