Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
UploadResult.php
1
<?php
2
3
namespace
Bitrix\UI\FileUploader
;
4
5
use
Bitrix\Main\Error
;
6
7
class
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
}
Bitrix\Main\Error
Definition
error.php:14
Bitrix\Main\Error\getMessage
getMessage()
Definition
error.php:62
Bitrix\Main\Error\getCode
getCode()
Definition
error.php:53
Bitrix\Main\Error\getCustomData
getCustomData()
Definition
error.php:70
Bitrix\Main\ORM\Data\Result
Definition
result.php:16
Bitrix\Main\Result\$errors
$errors
Definition
result.php:19
Bitrix\UI\FileUploader\FileInfo
Definition
FileInfo.php:8
Bitrix\UI\FileUploader\TempFile
Definition
TempFile.php:11
Bitrix\UI\FileUploader\UploadResult
Definition
UploadResult.php:8
Bitrix\UI\FileUploader\UploadResult\addError
addError(Error $error)
Definition
UploadResult.php:26
Bitrix\UI\FileUploader\UploadResult\getToken
getToken()
Definition
UploadResult.php:72
Bitrix\UI\FileUploader\UploadResult\addErrors
addErrors(array $errors)
Definition
UploadResult.php:42
Bitrix\UI\FileUploader\UploadResult\setDone
setDone(bool $done)
Definition
UploadResult.php:82
Bitrix\UI\FileUploader\UploadResult\reject
static reject(Error $error)
Definition
UploadResult.php:14
Bitrix\UI\FileUploader\UploadResult\$done
bool $done
Definition
UploadResult.php:12
Bitrix\UI\FileUploader\UploadResult\getTempFile
getTempFile()
Definition
UploadResult.php:52
Bitrix\UI\FileUploader\UploadResult\$tempFile
TempFile $tempFile
Definition
UploadResult.php:9
Bitrix\UI\FileUploader\UploadResult\$file
FileInfo $file
Definition
UploadResult.php:10
Bitrix\UI\FileUploader\UploadResult\setTempFile
setTempFile(TempFile $tempFile)
Definition
UploadResult.php:57
Bitrix\UI\FileUploader\UploadResult\isDone
isDone()
Definition
UploadResult.php:87
Bitrix\UI\FileUploader\UploadResult\jsonSerialize
jsonSerialize()
Definition
UploadResult.php:92
Bitrix\UI\FileUploader\UploadResult\getFileInfo
getFileInfo()
Definition
UploadResult.php:62
Bitrix\UI\FileUploader\UploadResult\setToken
setToken(string $token)
Definition
UploadResult.php:77
Bitrix\UI\FileUploader\UploadResult\setFileInfo
setFileInfo(?FileInfo $file)
Definition
UploadResult.php:67
Bitrix\UI\FileUploader\UploadResult\$token
string $token
Definition
UploadResult.php:11
Bitrix\UI\FileUploader\UploaderError
Definition
UploaderError.php:10
Bitrix\UI\FileUploader
Definition
CanUploadResult.php:3
modules
ui
lib
FileUploader
UploadResult.php
Создано системой
1.10.0