1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
UploadResult.php
См. документацию.
1<?php
2
3namespace Bitrix\UI\FileUploader;
4
5use Bitrix\Main\Error;
6
7class UploadResult extends \Bitrix\Main\Result implements \JsonSerializable
8{
9 protected ?TempFile $tempFile = null;
10 protected ?FileInfo $file = null;
11 protected ?string $token = null;
12 protected bool $done = false;
13
14 public static function reject(Error $error): self
15 {
16 $result = new static();
17 $result->addError($error);
18
19 return $result;
20 }
21
26 public function addError(Error $error)
27 {
28 if ($error instanceof UploaderError)
29 {
30 return parent::addError($error);
31 }
32 else
33 {
34 return parent::addError(new UploaderError(
35 $error->getCode(),
36 $error->getMessage(),
37 $error->getCustomData()
38 ));
39 }
40 }
41
42 public function addErrors(array $errors)
43 {
44 foreach ($errors as $error)
45 {
46 $this->addError($error);
47 }
48
49 return $this;
50 }
51
52 public function getTempFile(): ?TempFile
53 {
54 return $this->tempFile;
55 }
56
57 public function setTempFile(TempFile $tempFile): void
58 {
59 $this->tempFile = $tempFile;
60 }
61
62 public function getFileInfo(): ?FileInfo
63 {
64 return $this->file;
65 }
66
67 public function setFileInfo(?FileInfo $file): void
68 {
69 $this->file = $file;
70 }
71
72 public function getToken(): ?string
73 {
74 return $this->token;
75 }
76
77 public function setToken(string $token)
78 {
79 $this->token = $token;
80 }
81
82 public function setDone(bool $done): void
83 {
84 $this->done = $done;
85 }
86
87 public function isDone(): bool
88 {
89 return $this->done;
90 }
91
92 public function jsonSerialize(): array
93 {
94 return [
95 'token' => $this->getToken(),
96 'done' => $this->isDone(),
97 'file' => $this->getFileInfo(),
98 ];
99 }
100}
Определения error.php:15
ErrorCollection $errors
Определения result.php:19
addError(Error $error)
Определения UploadResult.php:26
addErrors(array $errors)
Определения UploadResult.php:42
setDone(bool $done)
Определения UploadResult.php:82
static reject(Error $error)
Определения UploadResult.php:14
setTempFile(TempFile $tempFile)
Определения UploadResult.php:57
setToken(string $token)
Определения UploadResult.php:77
setFileInfo(?FileInfo $file)
Определения UploadResult.php:67
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
$error
Определения subscription_card_product.php:20