/
githubmirror
/
symfony
Обзор
Документация
Войти
/
githubmirror
/
symfony
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
8.2
src/Symfony/Component/Workflow/TransitionBlockerList.php
72 строки
1 KB
Alexander M. Turek
Merge branch '5.4' into 6.0
03 ноя 2021, 16:44
03 ноя 2021, 16:44
3cdca3d
Код
Авторство
О чём код?
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Workflow; /** * A list of transition blockers. * * @author Grégoire Pineau <lyrixx@lyrixx.info> * * @implements \IteratorAggregate<int, TransitionBlocker> */ final class TransitionBlockerList implements \IteratorAggregate, \Countable { private array $blockers; /** * @param TransitionBlocker[] $blockers */ public function __construct(array $blockers = []) { $this->blockers = []; foreach ($blockers as $blocker) { $this->add($blocker); } } public function add(TransitionBlocker $blocker): void { $this->blockers[] = $blocker; } public function has(string $code): bool { foreach ($this->blockers as $blocker) { if ($code === $blocker->getCode()) { return true; } } return false; } public function clear(): void { $this->blockers = []; } public function isEmpty(): bool { return !$this->blockers; } public function getIterator(): \Traversable { return new \ArrayIterator($this->blockers); } public function count(): int { return \count($this->blockers); } }