1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
inmemory.php
См. документацию.
1<?php
2
3namespace Bitrix\Socialnetwork\Internals\LiveFeed\Counter\State;
4
5use Bitrix\Socialnetwork\Internals\LiveFeed\Counter\CounterState;
6use Bitrix\Socialnetwork\Internals\LiveFeed\Counter;
7
8class InMemory extends CounterState
9{
10 private array $state = [];
11
12 public function __construct(int $userId, Counter\Loader $loader)
13 {
14 parent::__construct($userId, $loader);
15 }
16
17 public function rewind(): void
18 {
19 reset($this->state);
20 }
21
22 public function current()
23 {
24 return current($this->state);
25 }
26
27 public function key()
28 {
29 return key($this->state);
30 }
31
32 public function next(): void
33 {
34 next($this->state);
35 }
36
37 public function valid(): bool
38 {
39 $key = key($this->state);
40 return ($key !== null && $key !== false);
41 }
42
43 public function getSize(): int
44 {
45 return count($this->state);
46 }
47
48 public function updateState(array $rawCounters, array $types = [], array $logIds = []): void
49 {
50 if (empty($logIds) && empty($types))
51 {
52 $this->state = [];
53 }
54 foreach ($this as $k => $row)
55 {
56 if (
57 !empty($logIds)
58 && !in_array($row['SONET_LOG_ID'], $logIds)
59 )
60 {
61 continue;
62 }
63
64 if (
65 !empty($types)
66 && !in_array($row['TYPE'], $types)
67 )
68 {
69 continue;
70 }
71 unset($this->state[$k]);
72 }
73 foreach ($rawCounters as $k => $row)
74 {
75 if (is_null($row))
76 {
77 unset($rawCounters[$k]);
78 }
79 }
80
81 $this->state = array_merge($this->state, $rawCounters);
82
83 $this->updateRawCounters();
84 }
85
86 protected function loadCounters(): void
87 {
88 $this->getLoader()->fetchCounters();
89
90 $this->updateState(
91 $this->getLoader()->getRawCounters()
92 );
93 }
94}
Определения loader.php:13
getRawCounters(string $meta=CounterDictionary::META_PROP_ALL)
Определения counterstate.php:66
__construct(int $userId, Counter\Loader $loader)
Определения inmemory.php:12
updateState(array $rawCounters, array $types=[], array $logIds=[])
Определения inmemory.php:48
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
if(empty($signedUserToken)) $key
Определения quickway.php:257
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
$k
Определения template_pdf.php:567