media-cloud-sync
/
includes
/
sdk
/
google
/
monolog
/
monolog
/
src
/
Monolog
/
Handler
/
Handler.php
Handler.php in Media Cloud Sync 1.2.5, at includes/sdk/google/monolog/monolog/src/Monolog/Handler/Handler.php
| 1 | <?php |
| 2 | |
| 3 | declare (strict_types=1); |
| 4 | /* |
| 5 | * This file is part of the Monolog package. |
| 6 | * |
| 7 | * (c) Jordi Boggiano <[email protected]> |
| 8 | * |
| 9 | * For the full copyright and license information, please view the LICENSE |
| 10 | * file that was distributed with this source code. |
| 11 | */ |
| 12 | namespace Dudlewebs\WPMCS\Monolog\Handler; |
| 13 | |
| 14 | /** |
| 15 | * Base Handler class providing basic close() support as well as handleBatch |
| 16 | * |
| 17 | * @author Jordi Boggiano <[email protected]> |
| 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 | * {@inheritDoc} |
| 32 | */ |
| 33 | public function close(): void |
| 34 | { |
| 35 | } |
| 36 | public function __destruct() |
| 37 | { |
| 38 | try { |
| 39 | $this->close(); |
| 40 | } catch (\Throwable $e) { |
| 41 | // do nothing |
| 42 | } |
| 43 | } |
| 44 | public function __sleep() |
| 45 | { |
| 46 | $this->close(); |
| 47 | $reflClass = new \ReflectionClass($this); |
| 48 | $keys = []; |
| 49 | foreach ($reflClass->getProperties() as $reflProp) { |
| 50 | if (!$reflProp->isStatic()) { |
| 51 | $keys[] = $reflProp->getName(); |
| 52 | } |
| 53 | } |
| 54 | return $keys; |
| 55 | } |
| 56 | } |
| 57 |