Version 1
[yaffs-website] / vendor / symfony / polyfill-php54 / Resources / stubs / CallbackFilterIterator.php
diff --git a/vendor/symfony/polyfill-php54/Resources/stubs/CallbackFilterIterator.php b/vendor/symfony/polyfill-php54/Resources/stubs/CallbackFilterIterator.php
new file mode 100644 (file)
index 0000000..b69db3d
--- /dev/null
@@ -0,0 +1,28 @@
+<?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.
+ */
+
+class CallbackFilterIterator extends FilterIterator
+{
+    private $iterator;
+    private $callback;
+
+    public function __construct(Iterator $iterator, $callback)
+    {
+        $this->iterator = $iterator;
+        $this->callback = $callback;
+        parent::__construct($iterator);
+    }
+
+    public function accept()
+    {
+        return call_user_func($this->callback, $this->current(), $this->key(), $this->iterator);
+    }
+}