Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
85.71% covered (warning)
85.71%
6 / 7
CRAP
86.67% covered (warning)
86.67%
13 / 15
TransitionBlockerList
0.00% covered (danger)
0.00%
0 / 1
85.71% covered (warning)
85.71%
6 / 7
10.24
86.67% covered (warning)
86.67%
13 / 15
 __construct
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
4 / 4
 add
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 has
100.00% covered (success)
100.00%
1 / 1
3
100.00% covered (success)
100.00%
4 / 4
 clear
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 isEmpty
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 getIterator
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 count
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
<?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>
 */
final class TransitionBlockerList implements \IteratorAggregate, \Countable
{
    private $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;
    }
    /**
     * {@inheritdoc}
     *
     * @return \ArrayIterator|TransitionBlocker[]
     */
    public function getIterator(): \Traversable
    {
        return new \ArrayIterator($this->blockers);
    }
    public function count(): int
    {
        return \count($this->blockers);
    }
}