Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
base.php
1<?php
2
4
9
10class 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}
addContent(string $code, $content, $type=false)
Definition base.php:25