1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
Request.php
См. документацию.
1<?php
2
3namespace Bitrix\UI\Helpdesk;
4
5use Bitrix\Main\Error;
6use Bitrix\Main\Result;
7use Bitrix\Main\Web\HttpClient;
8use Bitrix\Main\Web\Json;
9use Bitrix\Main\Web\Uri;
10
12{
13 private Url $url;
14 private RequestParametersBuilder $requestParametersBuilder;
15
16 public function __construct(private string $path, private ?array $additionalParameters = null)
17 {
18 $this->url = new Url();
19 $this->requestParametersBuilder = new RequestParametersBuilder();
20 }
21
22 public function send(): Result
23 {
24 $httpClient = new HttpClient();
25 $result = new Result();
26 $response = $httpClient->get($this->getPreparedUrl());
27
28 try
29 {
30 $result->setData((array)Json::decode($response));
31 }
32 catch (\Exception $e)
33 {
34 $result->addError(new Error($e->getMessage()));
35 }
36
37 return $result;
38 }
39
40 public function getUrl(): Url
41 {
42 return $this->url;
43 }
44
45 public function getPreparedUrl(): Uri
46 {
47 $parameters = $this->getParameters();
48
49 if ($this->additionalParameters)
50 {
51 $parameters = $this->additionalParameters + $parameters;
52 }
53
54 return $this->url->getByPath($this->path)->addParams($parameters);
55 }
56
57 public function getParameters(): array
58 {
59 return $this->requestParametersBuilder->build();
60 }
61}
$path
Определения access_edit.php:21
Определения error.php:15
Определения request.php:10
Определения uri.php:17
getParameters()
Определения Request.php:57
getPreparedUrl()
Определения Request.php:45
__construct(private string $path, private ?array $additionalParameters=null)
Определения Request.php:16
Определения Url.php:8
</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
$response
Определения result.php:21
path
Определения template_copy.php:201
$url
Определения iframe.php:7