1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
basiccomponent.php
См. документацию.
1<?php
2
3
4namespace Bitrix\Calendar\ICal\Basic;
5
6
7use Bitrix\Calendar\ICal\Builder\ComponentCreator;
8
9abstract class BasicComponent
10{
11 private $attachProperties = [];
12
13 private $attachSubComponent = [];
14
15 abstract public function getType() : string;
16
17 abstract public function getProperties(): array;
18
19 public function accessContent(): Content
20 {
21 $content = $this->setContent();
22
23 foreach ($this->attachProperties as $attachProperty)
24 {
25 $content->property($attachProperty);
26 }
27
28 $content->subComponent(...$this->attachSubComponent);
29
30 return $content;
31 }
32
33 public function toString(): string
34 {
35 $load = $this->accessContent();
36
37 $this->hasRequiredProperties($load);
38
39 $builder = new ComponentCreator($load);
40
41 return $builder->build();
42 }
43
44 public function appendProperty(PropertyType $property): BasicComponent
45 {
46 $this->attachProperties[] = $property;
47
48 return $this;
49 }
50
52 {
53 $this->attachSubComponent[] = $component;
54
55 return $this;
56 }
57
58 protected function hasRequiredProperties(Content $componentLoad)
59 {
60 $providedProperties = [];
61
62 foreach ($componentLoad->getProperties() as $property) {
63 $providedProperties = array_merge(
64 $providedProperties,
65 $property->getNames()
66 );
67 }
68
69 $requiredProperties = $this->getProperties();
70
71 $sameItems = array_intersect($requiredProperties, $providedProperties);
72
73 if (count($sameItems) !== count($requiredProperties)) {
74 $missingProperties = array_diff($requiredProperties, $sameItems);
75
76 throw InvalidComponent::requiredPropertyMissing($missingProperties, $this);
77 }
78 }
79}
hasRequiredProperties(Content $componentLoad)
Определения basiccomponent.php:58
appendSubComponent(BasicComponent $component)
Определения basiccomponent.php:51
appendProperty(PropertyType $property)
Определения basiccomponent.php:44
$content
Определения commerceml.php:144
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
</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