1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
PromotionList.php
См. документацию.
1<?php
2
3declare(strict_types=1);
4
5namespace Bitrix\Im\V2\Promotion\Entity;
6
7use ArrayIterator;
8use Bitrix\Im\V2\Rest\RestConvertible;
9use Bitrix\Main\Validation\Rule\ElementsType;
10use Bitrix\Main\Validation\Rule\Recursive\Validatable;
11use IteratorAggregate;
12
13class PromotionList implements RestConvertible, IteratorAggregate
14{
15 #[ElementsType(className: Promotion::class)]
16 #[Validatable(true)]
17 private array $promotions;
18
19 public function __construct(Promotion ...$promotions)
20 {
21 $this->promotions = $promotions ?: [];
22 }
23
24 public function add(Promotion ...$promotions): self
25 {
26 $this->promotions = array_merge($this->promotions, $promotions);
27
28 return $this;
29 }
30
31 public function merge(self $promotionList): self
32 {
33 $this->promotions = array_merge($this->promotions, $promotionList->promotions);
34
35 return $this;
36 }
37 public function toIdList(): array
38 {
39 return array_map(
40 static fn(Promotion $promotion) => $promotion->getId(),
41 $this->promotions
42 );
43 }
44
45 public static function getRestEntityName(): string
46 {
47 return 'promotions';
48 }
49
50 public function toRestFormat(array $option = []): array
51 {
52 return array_map(
53 static fn(Promotion $promotion) => $promotion->toRestFormat(),
54 $this->promotions
55 );
56 }
57
58 public function getIterator(): ArrayIterator
59 {
60 return new ArrayIterator($this->promotions);
61 }
62}
toRestFormat(array $option=[])
Определения Promotion.php:46
toRestFormat(array $option=[])
Определения PromotionList.php:50
merge(self $promotionList)
Определения PromotionList.php:31
__construct(Promotion ... $promotions)
Определения PromotionList.php:19
add(Promotion ... $promotions)
Определения PromotionList.php:24
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$option
Определения options.php:1711