PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 5.7.0
Defender Security – Malware Scanner, Login Security & Firewall v5.7.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / vendor / symfony / polyfill-php81 / Resources / stubs / CURLStringFile.php

CURLStringFile.php in Defender Security – Malware Scanner, Login Security & Firewall 5.7.0, 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