1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
CollabCollection.php
См. документацию.
1<?php
2
3declare(strict_types=1);
4
5namespace Bitrix\Socialnetwork\Collab;
6
7use ArrayAccess;
8use ArrayIterator;
9use Bitrix\Main\Type\Contract\Arrayable;
10use Countable;
11use IteratorAggregate;
12
17class CollabCollection implements ArrayAccess, IteratorAggregate, Arrayable, Countable
18{
20 protected array $collabs = [];
21
22 public function __construct(Collab ...$collabs)
23 {
24 foreach ($collabs as $collab)
25 {
26 $this->collabs[$collab->getId()] = $collab;
27 }
28 }
29
30 public function isEmpty(): bool
31 {
32 return empty($this->collabs);
33 }
34
35 public function offsetExists(mixed $offset): bool
36 {
37 return isset($this->collabs[$offset]);
38 }
39
40 public function offsetGet(mixed $offset): ?Collab
41 {
42 return $this->collabs[$offset] ?? null;
43 }
44
45 public function offsetSet(mixed $offset, mixed $value): void
46 {
47 $this->collabs[$offset] = $value;
48 }
49
50 public function offsetUnset(mixed $offset): void
51 {
52 unset($this->collabs[$offset]);
53 }
54
55 public function getIterator(): ArrayIterator
56 {
57 return new ArrayIterator($this->collabs);
58 }
59
60 public function toArray(): array
61 {
62 $data = [];
63 foreach ($this->collabs as $collab)
64 {
65 $data[$collab->getId()] = $collab->toArray();
66 }
67
68 return $data;
69 }
70
71 public function getFirst(): ?Collab
72 {
73 foreach ($this->collabs as $collab)
74 {
75 return $collab;
76 }
77
78 return null;
79 }
80
81 public function count(): int
82 {
83 return count($this->collabs);
84 }
85
86 public function __call(string $name, array $arguments = [])
87 {
88 $operation = substr($name, 0, 3);
89 $subOperation = lcfirst(substr($name, -4));
90
91 if ($operation === 'get' && $subOperation === 'list')
92 {
93 $property = strtoupper(substr($name, 3, -4));
94
95 return array_column($this->toArray(), $property);
96 }
97
98 return null;
99 }
100}
__call(string $name, array $arguments=[])
Определения CollabCollection.php:86
__construct(Collab ... $collabs)
Определения CollabCollection.php:22
offsetSet(mixed $offset, mixed $value)
Определения CollabCollection.php:45
$data['IS_AVAILABLE']
Определения .description.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$name
Определения menu_edit.php:35