Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
temporarystorage.php
1<?php
2
4
9{
10 protected $data;
11
16 public function getIdByPrimary($primary)
17 {
18 if(is_array($primary))
19 {
20 return $primary['ID'];
21 }
22
23 return $primary;
24 }
25
26 public function saveData($primary, array $data = null)
27 {
28 $this->data[$this->getIdByPrimary($primary)] = $data;
29 }
30
31 public function getData($primary): ?array
32 {
33 $primary = $this->getIdByPrimary($primary);
34 if(isset($this->data[$primary]) && !empty($this->data[$primary]))
35 {
36 $oldData = $this->data[$primary];
37 unset($this->data[$primary]);
38
39 return $oldData;
40 }
41
42 return null;
43 }
44}