PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.17
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.17
1.10.25 1.10.24 1.10.23 1.10.22 1.10.21 1.10.20 1.10.19 1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 All 169 releases
woocommerce-pos / vendor_prefixed / sentry / sentry / src / Serializer / RepresentationSerializer.php

RepresentationSerializer.php in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.10.17, at vendor_prefixed/sentry/sentry/src/Serializer/RepresentationSerializer.php

53 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare (strict_types=1);
4 namespace WCPOS\Vendor\Sentry\Serializer;
5
6 /**
7 * Serializes a value into a representation that should reasonably suggest
8 * both the type and value, and be serializable into JSON.
9 */
10 class RepresentationSerializer extends AbstractSerializer implements RepresentationSerializerInterface
11 {
12 /**
13 * {@inheritdoc}
14 */
15 public function representationSerialize($value)
16 {
17 $value = $this->serializeRecursively($value);
18 if (\is_numeric($value)) {
19 return (string) $value;
20 }
21 if (\is_bool($value)) {
22 return $value ? 'true' : 'false';
23 }
24 return $value;
25 }
26 /**
27 * This method is overridden to return even basic types as strings.
28 *
29 * @param mixed $value The value that needs to be serialized
30 *
31 * @return string
32 */
33 protected function serializeValue($value)
34 {
35 if ($value === null) {
36 return 'null';
37 }
38 if ($value === \false) {
39 return 'false';
40 }
41 if ($value === \true) {
42 return 'true';
43 }
44 if (\is_float($value) && (int) $value == $value) {
45 return $value . '.0';
46 }
47 if (\is_numeric($value)) {
48 return (string) $value;
49 }
50 return (string) parent::serializeValue($value);
51 }
52 }
53