Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
addresscollection.php
1<?php
2
4
7
14{
16 protected $items = [];
17
25 public function addItem($address): int
26 {
27 if(!($address instanceof Address))
28 {
29 throw new ArgumentTypeException('address must be the instance of Address');
30 }
31
32 return parent::addItem($address);
33 }
34
41 public function getAddressById(int $addressId): ?Address
42 {
43 foreach ($this->items as $item)
44 {
45 if ($item->getId() === $addressId)
46 {
47 return $item;
48 }
49 }
50
51 return null;
52 }
53}