Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php declare(strict_types=1);
2
 
3
/*
4
 * This file is part of the Monolog package.
5
 *
6
 * (c) Jordi Boggiano <j.boggiano@seld.be>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
 
12
namespace Monolog\Handler;
13
 
14
/**
15
 * Base Handler class providing basic close() support as well as handleBatch
16
 *
17
 * @author Jordi Boggiano <j.boggiano@seld.be>
18
 */
19
abstract class Handler implements HandlerInterface
20
{
21
    /**
22
     * {@inheritDoc}
23
     */
24
    public function handleBatch(array $records): void
25
    {
26
        foreach ($records as $record) {
27
            $this->handle($record);
28
        }
29
    }
30
 
31
    /**
32
     * {@inheritDoc}
33
     */
34
    public function close(): void
35
    {
36
    }
37
 
38
    public function __destruct()
39
    {
40
        try {
41
            $this->close();
42
        } catch (\Throwable $e) {
43
            // do nothing
44
        }
45
    }
46
 
47
    public function __sleep()
48
    {
49
        $this->close();
50
 
51
        $reflClass = new \ReflectionClass($this);
52
 
53
        $keys = [];
54
        foreach ($reflClass->getProperties() as $reflProp) {
55
            if (!$reflProp->isStatic()) {
56
                $keys[] = $reflProp->getName();
57
            }
58
        }
59
 
60
        return $keys;
61
    }
62
}