PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.21
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.21
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 1.10.1 1.10.0 1.9.17 All 166 releases
woocommerce-pos / vendor / symfony / polyfill-php81 / Resources / stubs / CURLStringFile.php

CURLStringFile.php in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.10.21, at vendor/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php

52 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <[email protected]>
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 if (\PHP_VERSION_ID >= 70400 && extension_loaded('curl')) {
13 /**
14 * @property string $data
15 */
16 class CURLStringFile extends CURLFile
17 {
18 private $data;
19
20 public function __construct(string $data, string $postname, string $mime = 'application/octet-stream')
21 {
22 $this->data = $data;
23 parent::__construct('data://application/octet-stream;base64,'.base64_encode($data), $mime, $postname);
24 }
25
26 public function __set(string $name, $value): void
27 {
28 if ('data' !== $name) {
29 $this->$name = $value;
30
31 return;
32 }
33
34 if (is_object($value) ? !method_exists($value, '__toString') : !is_scalar($value)) {
35 throw new TypeError('Cannot assign '.gettype($value).' to property CURLStringFile::$data of type string');
36 }
37
38 $this->name = 'data://application/octet-stream;base64,'.base64_encode($value);
39 }
40
41 public function __isset(string $name): bool
42 {
43 return isset($this->$name);
44 }
45
46 public function &__get(string $name)
47 {
48 return $this->$name;
49 }
50 }
51 }
52