Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
collection.php
1<?php
2
4
6
15abstract class Collection extends BaseGeometry
16{
18 protected $components = [];
19
25 public function __construct(array $components = [])
26 {
27 foreach ($components as $component)
28 {
29 if ($component instanceof BaseGeometry)
30 {
31 $this->components[] = $component;
32 }
33 else
34 {
35 throw new SystemException('Cannot create a collection with non-geometries');
36 }
37 }
38 }
39
43 public function getComponents(): array
44 {
45 return $this->components;
46 }
47
51 public function getComponentsCount(): int
52 {
53 return count($this->components);
54 }
55
59 public function asArray(): array
60 {
61 $result = [];
62
63 foreach ($this->components as $component)
64 {
65 $result[] = $component->asArray();
66 }
67
68 return $result;
69 }
70}