Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
pool.php
1
<?php
2
namespace
Bitrix\Location\Repository\Location\Cache
;
3
4
use
Bitrix\Location\Entity\Location
;
5
use
Bitrix\Main\ArgumentTypeException
;
6
use
Bitrix\Main\Web\Json
;
7
12
class
Pool
extends
\Bitrix\Location\Common\Pool
13
{
18
public
function
getItem
(
string
$index)
19
{
20
$result = parent::getItem($index);
21
22
try
23
{
24
$result = Json::decode($result);
25
$result =
Location::fromArray
($result);
26
}
27
catch
(\Exception $e)
28
{
29
$result =
null
;
30
}
31
32
return
$result;
33
}
34
35
public
function
addItem
(
string
$index, $location): void
36
{
37
if
(!($location instanceof
Location
))
38
{
39
throw
new
ArgumentTypeException
(
'location must be type of Location'
);
40
}
41
42
parent::addItem(
43
$index, Json::encode(
44
$location->toArray()
45
)
46
);
47
}
48
}
Bitrix\Location\Common\Pool
Definition
pool.php:9
Bitrix\Location\Entity\Location
Definition
location.php:20
Bitrix\Location\Entity\Location\fromArray
static fromArray(array $location)
Definition
location.php:550
Bitrix\Location\Repository\Location\Cache\Pool
Definition
pool.php:13
Bitrix\Location\Repository\Location\Cache\Pool\addItem
addItem(string $index, $location)
Definition
pool.php:35
Bitrix\Location\Repository\Location\Cache\Pool\getItem
getItem(string $index)
Definition
pool.php:18
Bitrix\Main\ArgumentTypeException
Definition
exception.php:114
Bitrix\Main\Web\Json
Definition
json.php:11
Bitrix\Location\Entity\Location
Definition
collection.php:3
Bitrix\Location\Repository\Location\Cache
Definition
pool.php:2
modules
location
lib
repository
location
cache
pool.php
Создано системой
1.10.0