403Webshell
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/parser/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/ilovecveti.ru/bitrix/modules/calendar/lib/ical/parser/componentscollection.php
<?php


namespace Bitrix\Calendar\ICal\Parser;


use ArrayIterator;
use IteratorAggregate;
use LogicException;

class ComponentsCollection implements IteratorAggregate
{
	/**
	 * @var ParserComponent[]
	 */
	private $collection;

	/**
	 * @param ParserComponent[]|null $collection
	 * @return ComponentsCollection
	 */
	public static function createInstance(array $collection = null): ComponentsCollection
	{
		return new self($collection);
	}

	/**
	 * ComponentsCollection constructor.
	 * @param ParserComponent[]|null $collection
	 */
	public function __construct(array $collection = null)
	{
		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\\Builder\\Attendee');
		}

		$this->collection = $collection ?? [];
	}

	/**
	 * @return ArrayIterator
	 */
	public function getIterator(): ArrayIterator
	{
		return new ArrayIterator($this->collection);
	}

	/**
	 * @param ParserComponent|null $component
	 * @return $this
	 */
	public function add(?ParserComponent $component): ComponentsCollection
	{
		if ($component === null)
		{
			return $this;
		}

		$this->collection[] = $component;

		return $this;
	}

	/**
	 * @return int
	 */
	public function count(): int
	{
		return count($this->collection);
	}

	/**
	 * @return bool
	 */
	public function hasOneComponent(): bool
	{
		return $this->count() === 1;
	}

	/**
	 * @return bool
	 */
	public function hasOneCalendarComponent(): bool
	{
		return $this->hasOneComponent() && ($this->collection[0] instanceof Calendar);
	}

	/**
	 * @param array|null collection
	 * @return bool
	 */
	private function checkCollection(?array $collection): bool
	{
		if ($collection === null)
		{
			return true;
		}

		$attendee = array_filter($collection, function ($attendee) {
			return !($attendee instanceof ParserComponent);
		});

		return empty($attendee);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit