Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationDI
      • ApplicationLatte
      • ApplicationTracy
      • CacheDI
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsDI
      • FormsLatte
      • Framework
      • HttpDI
      • HttpTracy
      • MailDI
      • ReflectionDI
      • SecurityDI
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Conventions
      • Drivers
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
      • Traits
    • Reflection
    • Security
    • Tokenizer
    • Utils
  • Tracy
    • Bridges
      • Nette
  • none

Classes

  • CachingIterator
  • Mapper
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Other releases
 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: 
 8: namespace Nette\Iterators;
 9: 
10: 
11: 
12: /**
13:  * Applies the callback to the elements of the inner iterator.
14:  */
15: class Mapper extends \IteratorIterator
16: {
17:     /** @var callable */
18:     private $callback;
19: 
20: 
21:     public function __construct(\Traversable $iterator, callable $callback)
22:     {
23:         parent::__construct($iterator);
24:         $this->callback = $callback;
25:     }
26: 
27: 
28:     public function current()
29:     {
30:         return call_user_func($this->callback, parent::current(), parent::key());
31:     }
32: }
33: 
Nette 2.4-20180918 API API documentation generated by ApiGen 2.8.0