4 * This file is part of the Behat.
5 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
11 namespace Behat\Testwork\Output\Node\EventListener\Flow;
13 use Behat\Testwork\Output\Formatter;
14 use Behat\Testwork\Output\Node\EventListener\EventListener;
15 use Symfony\Component\EventDispatcher\Event;
18 * Catches all events, but proxies them only if formatter has specific parameter set to a specific value.
20 * @author Konstantin Kudryashov <ever.zet@gmail.com>
22 class FireOnlyIfFormatterParameterListener implements EventListener
38 * Initializes listener.
42 * @param EventListener $descendant
44 public function __construct($name, $value, EventListener $descendant)
47 $this->value = $value;
48 $this->descendant = $descendant;
54 public function listenEvent(Formatter $formatter, Event $event, $eventName)
56 if ($this->value !== $formatter->getParameter($this->name)) {
60 $this->descendant->listenEvent($formatter, $event, $eventName);