commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
MapperIterator.php
1 <?php
2 
3 declare(strict_types=1);
10 namespace Commercetools\Base;
11 
12 class MapperIterator extends \IteratorIterator
13 {
17  private $mapper;
18 
19  public function __construct(\Traversable $iterator, callable $mapper)
20  {
21  parent::__construct($iterator);
22  $this->mapper = $mapper;
23  }
24 
25  #[\ReturnTypeWillChange]
26  public function current()
27  {
29  return call_user_func($this->mapper, parent::current(), parent::key());
30  }
31 }
__construct(\Traversable $iterator, callable $mapper)