Skip to content

Commit

Permalink
add: extract array context
Browse files Browse the repository at this point in the history
  • Loading branch information
ulcuber committed Feb 22, 2024
1 parent 5aa9179 commit 053ca89
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Entities/LogEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ protected function setHeader(array $header)

$reminder = array_pop($matches);

$regex = '/{(?:[^{}]|(?R))*}/xm';
$regex = '/(?:\[(?:[^\[\]]|(?R))*\]|{(?:[^{}]|(?R))*})/xm';
$reminder = preg_replace_callback($regex, function ($replaceable) {
if (! is_null($context = json_decode($replaceable[0], true))) {
$this->setContext($context);
Expand All @@ -224,6 +224,7 @@ protected function setHeader(array $header)

return $replaceable[0];
}, $reminder);
$regex = '/{(?:[^{}]|(?R))*}/xm';
if (! $this->context && ! strpos($this->stack, '>>>>>>>>')) {
$this->stack = preg_replace_callback($regex, function ($replaceable) {
if (! is_null($context = json_decode($replaceable[0], true))) {
Expand Down

0 comments on commit 053ca89

Please sign in to comment.