1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
formresponse.php
См. документацию.
1<?php
2
3namespace Bitrix\Seo\LeadAds\Response;
4
5
6use Bitrix\Main\Result;
7use Bitrix\Seo\LeadAds\LeadAdsForm;
8use Bitrix\Seo\Retargeting\Response;
9use Bitrix\Seo\LeadAds\Response\Builder\FormBuilderInterface;
10
11class FormResponse extends Result
12{
14 protected $data = [];
15
17 protected $formBuilder;
18
20 private $currentResponse;
21
23 private $responseCount;
24
29 public function __construct(FormBuilderInterface $formBuilder, Response... $responses)
30 {
31 parent::__construct();
32
33 $this->formBuilder = $formBuilder;
34 $this->currentResponse = 0;
35 $this->responseCount = count($responses);
36
37 foreach ($responses as $response)
38 {
39 if (!$response->isSuccess())
40 {
41 $this->addErrors($response->getErrors());
42 }
43 }
44
45 $this->data = array_values($responses);
46 }
47
54 public function setData(array $data): FormResponse
55 {
56 return new static($this->formBuilder,...$data);
57 }
58
62 public function fetch(): ?LeadAdsForm
63 {
64 if ($this->currentResponse >= $this->responseCount || !$this->isSuccess())
65 {
66 return null;
67 }
68
70 if (!$form = $this->data[$this->currentResponse]->fetch())
71 {
72 ++$this->currentResponse;
73
74 return $this->fetch();
75 }
76
77 return $this->formBuilder->buildForm($form);
78 }
79
83 public function fetchAll(): array
84 {
85 for($fetchResult = array(); null !== $item = $this->fetch();)
86 {
87 $fetchResult[] = $item;
88 }
89
90 return $fetchResult;
91 }
92}
Определения response.php:5
addErrors(array $errors)
Определения result.php:113
isSuccess()
Определения result.php:39
__construct(FormBuilderInterface $formBuilder, Response... $responses)
Определения formresponse.php:29
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
$response
Определения result.php:21