Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/ilovecveti.ru/bitrix/modules/calendar/lib/ical/basic/ |
Upload File : |
<?php namespace Bitrix\Calendar\ICal\Basic; use Bitrix\Calendar\ICal\Builder\ComponentCreator; abstract class BasicComponent { private $attachProperties = []; private $attachSubComponent = []; abstract public function getType() : string; abstract public function getProperties(): array; public function accessContent(): Content { $content = $this->setContent(); foreach ($this->attachProperties as $attachProperty) { $content->property($attachProperty); } $content->subComponent(...$this->attachSubComponent); return $content; } public function toString(): string { $load = $this->accessContent(); $this->hasRequiredProperties($load); $builder = new ComponentCreator($load); return $builder->build(); } public function appendProperty(PropertyType $property): BasicComponent { $this->attachProperties[] = $property; return $this; } public function appendSubComponent(BasicComponent $component): BasicComponent { $this->attachSubComponent[] = $component; return $this; } protected function hasRequiredProperties(Content $componentLoad) { $providedProperties = []; foreach ($componentLoad->getProperties() as $property) { $providedProperties = array_merge( $providedProperties, $property->getNames() ); } $requiredProperties = $this->getProperties(); $sameItems = array_intersect($requiredProperties, $providedProperties); if (count($sameItems) !== count($requiredProperties)) { $missingProperties = array_diff($requiredProperties, $sameItems); throw InvalidComponent::requiredPropertyMissing($missingProperties, $this); } } }