Security update for permissions_by_term
[yaffs-website] / vendor / behat / behat / src / Behat / Testwork / Output / Node / EventListener / ChainEventListener.php
diff --git a/vendor/behat/behat/src/Behat/Testwork/Output/Node/EventListener/ChainEventListener.php b/vendor/behat/behat/src/Behat/Testwork/Output/Node/EventListener/ChainEventListener.php
new file mode 100644 (file)
index 0000000..0c76bac
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+
+/*
+ * This file is part of the Behat.
+ * (c) Konstantin Kudryashov <ever.zet@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Behat\Testwork\Output\Node\EventListener;
+
+use ArrayIterator;
+use Behat\Testwork\Output\Formatter;
+use Countable;
+use IteratorAggregate;
+use Symfony\Component\EventDispatcher\Event;
+
+/**
+ * Used to compose formatter event listeners.
+ *
+ * @author Konstantin Kudryashov <ever.zet@gmail.com>
+ */
+class ChainEventListener implements EventListener, Countable, IteratorAggregate
+{
+    /**
+     * @var EventListener[]
+     */
+    private $listeners;
+
+    /**
+     * Initializes collection.
+     *
+     * @param EventListener[] $listeners
+     */
+    public function __construct(array $listeners)
+    {
+        $this->listeners = $listeners;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function listenEvent(Formatter $formatter, Event $event, $eventName)
+    {
+        foreach ($this->listeners as $listener) {
+            $listener->listenEvent($formatter, $event, $eventName);
+        }
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function count()
+    {
+        return count($this->listeners);
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getIterator()
+    {
+        return new ArrayIterator($this->listeners);
+    }
+}