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/builder/ |
Upload File : |
<?php namespace Bitrix\Calendar\ICal\Builder; use Bitrix\Calendar\SerializeObject; use ArrayIterator; use IteratorAggregate; use LogicException; use Serializable; class AttachCollection implements IteratorAggregate, Serializable { use SerializeObject; /** * @var array */ private $collection; /** * @param Attach[] $collection * @return AttachCollection */ public static function createInstance(array $collection = []): AttachCollection { return new self($collection); } /** * AttachCollection constructor. * @param Attach[] $collection */ public function __construct(array $collection = []) { if (!$this->checkCollection($collection)) { throw new LogicException('The collection contains elements of the wrong class. You need to pass a collection of objects Bitrix\\Calendar\\ICal\\Parser\\Attendee'); } $this->collection = $collection; } /** * @param Attach $attach * @return $this */ public function add(Attach $attach): AttachCollection { $this->collection[] = $attach; return $this; } /** * @return array */ public function getCollection(): array { return $this->collection; } /** * @return ArrayIterator */ public function getIterator(): ArrayIterator { return new ArrayIterator($this->collection); } public function getCount(): int { return count($this->collection); } /** * @param array $collection * @return bool */ private function checkCollection(array $collection): bool { if (is_null($collection)) { return true; } $attach = array_filter($collection, function ($attach) { return !($attach instanceof Attach); }); return empty($attach); } }