Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
base.php
1
<?php
2
3
namespace
Bitrix\Rest\Configuration\DataProvider\IO
;
4
5
use
Bitrix\Main\SystemException
;
6
use
Bitrix\Main\IO\File
;
7
use
Bitrix\Main\IO\FileNotFoundException
;
8
use
Bitrix\Rest\Configuration\DataProvider\ProviderBase
;
9
10
class
Base
extends
ProviderBase
11
{
17
public
function
__construct
(array $setting)
18
{
19
parent::__construct($setting);
20
}
21
25
public
function
addContent
(
string
$code, $content, $type =
false
): bool
26
{
27
throw
new
SystemException
(
28
'This method isn\'t supported'
,
29
'ERROR_METHOD'
30
);
31
}
32
41
public
function
get
(
string
$path,
int
$step): ?array
42
{
43
$result =
null
;
44
if
($path)
45
{
46
$fileInfo = \CFile::MakeFileArray($path);
47
if
(is_array($fileInfo) && $fileInfo[
'tmp_name'
] && File::isFileExists($fileInfo[
'tmp_name'
]))
48
{
49
preg_match(
"/\/([a-zA-Z0-9_-]+)\.[a-zA-Z0-9_-]+$/"
, $path, $matches);
50
$name = $matches[1] ??
null
;
51
52
$file =
new
File
($fileInfo[
'tmp_name'
]);
53
try
54
{
55
$result = [
56
'DATA'
=> $file->getContents(),
57
'FILE_NAME'
=> $name,
58
];
59
}
60
catch
(
FileNotFoundException
$exception)
61
{
62
$result =
null
;
63
}
64
}
65
}
66
67
return
$result;
68
}
69
75
public
function
addFiles
(array $files): array
76
{
77
throw
new
SystemException
(
78
'This method isn\'t supported'
,
79
'ERROR_METHOD'
80
);
81
}
82
}
Bitrix\Main\IO\File
Definition
file.php:7
Bitrix\Main\IO\FileNotFoundException
Definition
ioexception.php:45
Bitrix\Main\SystemException
Definition
exception.php:8
Bitrix\Rest\Configuration\DataProvider\IO\Base
Definition
base.php:11
Bitrix\Rest\Configuration\DataProvider\IO\Base\addContent
addContent(string $code, $content, $type=false)
Definition
base.php:25
Bitrix\Rest\Configuration\DataProvider\IO\Base\__construct
__construct(array $setting)
Definition
base.php:17
Bitrix\Rest\Configuration\DataProvider\IO\Base\addFiles
addFiles(array $files)
Definition
base.php:75
Bitrix\Rest\Configuration\DataProvider\ProviderBase
Definition
providerbase.php:15
Bitrix\Rest\Configuration\DataProvider\IO
Definition
base.php:3
modules
rest
lib
configuration
dataprovider
io
base.php
Создано системой
1.10.0