PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.27
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.27
1.10.27 1.10.26 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 All 171 releases
woocommerce-pos / vendor_prefixed / sentry / sentry / src / DataCollection / InMemoryHttpBodySource.php

InMemoryHttpBodySource.php in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.10.27, at vendor_prefixed/sentry/sentry/src/DataCollection/InMemoryHttpBodySource.php

48 lines 1.0 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\DataCollection;
5
6 /**
7 * @internal
8 */
9 final class InMemoryHttpBodySource implements HttpBodySourceInterface
10 {
11 /**
12 * @var array<array-key, mixed>|string|null
13 */
14 private $body;
15 /**
16 * @var string
17 */
18 private $contentType;
19 /**
20 * @var int|null
21 */
22 private $bodyLength;
23 /**
24 * @param mixed $body
25 */
26 public function __construct($body, string $contentType = '', ?int $bodyLength = null)
27 {
28 $this->body = \is_array($body) || \is_string($body) ? $body : null;
29 $this->contentType = $contentType;
30 $this->bodyLength = $bodyLength;
31 }
32 public function getKnownLength() : ?int
33 {
34 return \is_string($this->body) ? \max(\strlen($this->body), $this->bodyLength ?? 0) : $this->bodyLength;
35 }
36 public function getContentType() : string
37 {
38 return $this->contentType;
39 }
40 /**
41 * {@inheritdoc}
42 */
43 public function read(int $limit)
44 {
45 return $this->body;
46 }
47 }
48