Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
parents.php
1
<?php
2
3
namespace
Bitrix\Location\Entity\Location
;
4
5
use
Bitrix\Location\Entity\Location
;
6
12
final
class
Parents
extends
Collection
13
{
15
protected
$items
= [];
17
protected
$descendant
;
18
22
public
function
getDescendant
(): ?
Location
23
{
24
return
$this->descendant
;
25
}
26
31
public
function
setDescendant
(
Location
$descendant
): self
32
{
33
$this->descendant =
$descendant
;
34
return
$this;
35
}
36
43
public
function
isContain
(
Location
$location): bool
44
{
45
foreach
($this->items as $item)
46
{
47
if
($item->isEqualTo($location))
48
{
49
return
true
;
50
}
51
}
52
53
return
false
;
54
}
55
62
public
function
isEqualTo(
Parents
$parents): bool
63
{
64
if
($this->
count
() !== $parents->
count
())
65
{
66
return
false
;
67
}
68
73
foreach
($this as $idx => $item)
74
{
75
if
(!$item->isEqualTo($parents[$idx]))
76
{
77
return
false
;
78
}
79
}
80
81
return
true
;
82
}
83
90
public
function
getItemByType
(
int
$type):?
Location
91
{
92
foreach
($this->items as $item)
93
{
94
if
($item->getType() === $type)
95
{
96
return
$item;
97
}
98
}
99
100
return
null
;
101
}
102
}
Bitrix\Location\Entity\Generic\Collection\count
count()
Definition
collection.php:88
Bitrix\Location\Entity\Location\Collection
Definition
collection.php:15
Bitrix\Location\Entity\Location\Parents
Definition
parents.php:13
Bitrix\Location\Entity\Location\Parents\$descendant
$descendant
Definition
parents.php:17
Bitrix\Location\Entity\Location\Parents\getItemByType
getItemByType(int $type)
Definition
parents.php:90
Bitrix\Location\Entity\Location\Parents\$items
$items
Definition
parents.php:15
Bitrix\Location\Entity\Location\Parents\setDescendant
setDescendant(Location $descendant)
Definition
parents.php:31
Bitrix\Location\Entity\Location\Parents\getDescendant
getDescendant()
Definition
parents.php:22
Bitrix\Location\Entity\Location\Parents\isContain
isContain(Location $location)
Definition
parents.php:43
Bitrix\Location\Entity\Location
Definition
location.php:20
Bitrix\Location\Entity\Location
Definition
collection.php:3
modules
location
lib
entity
location
parents.php
Создано системой
1.10.0