1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-04 20:27:31 +02:00

Add docblocks and return type to the FingersCrossed strategy classes.

This commit is contained in:
Kat
2018-07-17 17:32:33 +01:00
parent 10bef97dea
commit dc003d137e
2 changed files with 18 additions and 1 deletions

View File

@@ -35,14 +35,21 @@ use Monolog\Logger;
*/ */
class ChannelLevelActivationStrategy implements ActivationStrategyInterface class ChannelLevelActivationStrategy implements ActivationStrategyInterface
{ {
/**
* @var string|int
*/
private $defaultActionLevel; private $defaultActionLevel;
/**
* @var array
*/
private $channelToActionLevel; private $channelToActionLevel;
/** /**
* @param int $defaultActionLevel The default action level to be used if the record's category doesn't match any * @param int $defaultActionLevel The default action level to be used if the record's category doesn't match any
* @param array $channelToActionLevel An array that maps channel names to action levels. * @param array $channelToActionLevel An array that maps channel names to action levels.
*/ */
public function __construct($defaultActionLevel, $channelToActionLevel = []) public function __construct($defaultActionLevel, array $channelToActionLevel = [])
{ {
$this->defaultActionLevel = Logger::toMonologLevel($defaultActionLevel); $this->defaultActionLevel = Logger::toMonologLevel($defaultActionLevel);
$this->channelToActionLevel = array_map('Monolog\Logger::toMonologLevel', $channelToActionLevel); $this->channelToActionLevel = array_map('Monolog\Logger::toMonologLevel', $channelToActionLevel);

View File

@@ -20,13 +20,23 @@ use Monolog\Logger;
*/ */
class ErrorLevelActivationStrategy implements ActivationStrategyInterface class ErrorLevelActivationStrategy implements ActivationStrategyInterface
{ {
/**
* @var string|int
*/
private $actionLevel; private $actionLevel;
/**
* @param string|int $actionLevel
*/
public function __construct($actionLevel) public function __construct($actionLevel)
{ {
$this->actionLevel = Logger::toMonologLevel($actionLevel); $this->actionLevel = Logger::toMonologLevel($actionLevel);
} }
/**
* @param array $record
* @return bool
*/
public function isHandlerActivated(array $record): bool public function isHandlerActivated(array $record): bool
{ {
return $record['level'] >= $this->actionLevel; return $record['level'] >= $this->actionLevel;