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/builder/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

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


namespace Bitrix\Calendar\ICal\Builder;


use Bitrix\Calendar\SerializeObject;
use ArrayIterator;
use IteratorAggregate;
use Serializable;

/**
 * Class AttendeesCollection
 * @package Bitrix\Calendar\ICal\Builder
 */
class AttendeesCollection implements IteratorAggregate, Serializable
{
	use SerializeObject;
	/**
	 * @var array
	 */
	private array $collection;

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


	/**
	 * AttendeesCollection constructor.
	 * @param array|null $collection
	 */
	public function __construct(array $collection = [])
	{
		if (!$this->checkCollection($collection))
		{
			throw new \InvalidArgumentException('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 string
	 */
	public function __toString(): string
	{
		if (empty($this->collection))
		{
			return '';
		}

		$result = [];
		foreach ($this->collection as $attendee)
		{
			if (!empty($attendee->getFullName()))
			{
				$result[] = $attendee->getFullName();
			}
		}

		return implode(', ', $result);
	}

	/**
	 * @param Attendee $attendee
	 * @return $this
	 */
	public function add(Attendee $attendee): AttendeesCollection
	{
		$this->collection[] = $attendee;

		return $this;
	}

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

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

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

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

		return empty($attendee);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit