src
1 year ago
LICENSE
2 years ago
NOTICE
2 years ago
README.md
2 years ago
autoload.php
2 years ago
functions.php
7 months ago
functions.php
39 lines
| 1 | <?php |
| 2 | |
| 3 | /* =========================================================================== |
| 4 | * Copyright (c) 2018-2021 Zindex Software |
| 5 | * |
| 6 | * Licensed under the MIT License |
| 7 | * =========================================================================== */ |
| 8 | namespace Matomo\Dependencies\Opis\Closure; |
| 9 | |
| 10 | /** |
| 11 | * Serialize |
| 12 | * |
| 13 | * @param mixed $data |
| 14 | * @return string |
| 15 | */ |
| 16 | function serialize($data) |
| 17 | { |
| 18 | SerializableClosure::enterContext(); |
| 19 | SerializableClosure::wrapClosures($data); |
| 20 | $data = \serialize($data); |
| 21 | SerializableClosure::exitContext(); |
| 22 | return $data; |
| 23 | } |
| 24 | /** |
| 25 | * Unserialize |
| 26 | * |
| 27 | * @param string $data |
| 28 | * @param array|null $options |
| 29 | * @return mixed |
| 30 | */ |
| 31 | function unserialize($data, $options = null) |
| 32 | { |
| 33 | SerializableClosure::enterContext(); |
| 34 | $data = $options === null || \PHP_MAJOR_VERSION < 7 ? \unserialize($data) : \unserialize($data, $options); |
| 35 | SerializableClosure::unwrapClosures($data); |
| 36 | SerializableClosure::exitContext(); |
| 37 | return $data; |
| 38 | } |
| 39 |