1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-22 09:06:10 +02:00

Improve build

This commit is contained in:
Jordi Boggiano
2020-12-09 14:22:04 +01:00
parent bd9570d835
commit c5853b9b0f
27 changed files with 127 additions and 72 deletions

View File

@@ -24,10 +24,14 @@ class NormalizerFormatter implements FormatterInterface
{
public const SIMPLE_DATE = "Y-m-d\TH:i:sP";
/** @var string */
protected $dateFormat;
/** @var int */
protected $maxNormalizeDepth = 9;
/** @var int */
protected $maxNormalizeItemCount = 1000;
/** @var int */
private $jsonEncodeOptions = Utils::DEFAULT_JSON_FLAGS;
/**
@@ -159,12 +163,7 @@ class NormalizerFormatter implements FormatterInterface
$value = $data->__toString();
} else {
// the rest is normalized by json encoding and decoding it
$encoded = $this->toJson($data, true);
if ($encoded === false) {
$value = 'JSON_ERROR';
} else {
$value = json_decode($encoded, true);
}
$value = json_decode($this->toJson($data, true), true);
}
return [Utils::getClass($data) => $value];
@@ -248,12 +247,12 @@ class NormalizerFormatter implements FormatterInterface
return $date->format($this->dateFormat);
}
public function addJsonEncodeOption($option)
public function addJsonEncodeOption(int $option)
{
$this->jsonEncodeOptions |= $option;
}
public function removeJsonEncodeOption($option)
public function removeJsonEncodeOption(int $option)
{
$this->jsonEncodeOptions &= ~$option;
}