ArrayHandler::handler()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 7
rs 10
1
<?php
2
3
namespace Tleckie\Log\Formatter\Handler;
4
5
/**
6
 * Class ArrayHandler
7
 *
8
 * @package Tleckie\Log\Formatter\Handler
9
 * @author  Teodoro Leckie Westberg <[email protected]>
10
 */
11
class ArrayHandler extends Handler
12
{
13
    /**
14
     * @param mixed $message
15
     * @param array $context
16
     * @return string
17
     */
18
    public function handler(mixed $message, array $context = []): string
19
    {
20
        if (is_array($message)) {
21
            $message = $this->encode($message);
22
        }
23
24
        return parent::handler($message, $context);
25
    }
26
}
27