Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
poolbase.php
1<?php
3
5{
6 protected static $pool = array();
7 protected static $index = 0;
8
9 public static function getPoolByCode($code)
10 {
11 if (isset(static::$pool[$code]))
12 {
13 return static::$pool[$code];
14 }
15
16 return null;
17 }
18
19 public static function get($code, $type)
20 {
21 if (isset(static::$pool[$code][$type]))
22 {
23 return static::$pool[$code][$type];
24 }
25
26 return null;
27 }
28
36 public static function getByIndex($code, $type, $index)
37 {
38 if (isset(static::$pool[$code][$type][$index]))
39 {
40 return static::$pool[$code][$type][$index];
41 }
42
43 return null;
44 }
45
51 public static function add($code, $type, $value)
52 {
53 static::$index++;
54 static::$pool[$code][$type][static::$index] = $value;
55 }
56
62 public static function delete($code, $type, $index)
63 {
64 if (isset(static::$pool[$code][$type][$index]))
65 {
66 unset(static::$pool[$code][$type][$index]);
67 }
68 }
69
76 public static function isTypeExists($code, $type)
77 {
78 return (!empty(static::$pool[$code][$type]));
79 }
80
85 public static function resetPool($code = null, $type = null)
86 {
87 if ($code !== null)
88 {
89 if ($type !== null)
90 {
91 unset(static::$pool[$code][$type]);
92 }
93 else
94 {
95 unset(static::$pool[$code]);
96 }
97 }
98 else
99 {
100 static::$pool = array();
101 }
102
103 if (empty(static::$pool[$code]))
104 {
105 unset(static::$pool[$code]);
106 }
107 }
108}
static resetPool($code=null, $type=null)
Definition poolbase.php:85
static add($code, $type, $value)
Definition poolbase.php:51
static isTypeExists($code, $type)
Definition poolbase.php:76
static getByIndex($code, $type, $index)
Definition poolbase.php:36