friendship ended with social-app. php is my new best friend
1<?php
2
3/**
4 * This file is part of the Nette Framework (https://nette.org)
5 * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6 */
7
8declare(strict_types=1);
9
10namespace Nette\Iterators;
11
12
13/**
14 * @deprecated use Nette\Utils\Iterables::map()
15 */
16class Mapper extends \IteratorIterator
17{
18 /** @var callable */
19 private $callback;
20
21
22 public function __construct(\Traversable $iterator, callable $callback)
23 {
24 parent::__construct($iterator);
25 $this->callback = $callback;
26 }
27
28
29 public function current(): mixed
30 {
31 return ($this->callback)(parent::current(), parent::key());
32 }
33}