Namespaces

  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Config
      • Adapters
      • Extensions
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
      • Diagnostics
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • Reflection
    • Security
      • Diagnostics
    • Templating
    • Utils
      • PhpGenerator
  • NetteModule
  • none

Classes

  • CachingIterator
  • Filter
  • InstanceFilter
  • Mapper
  • RecursiveFilter
  • Recursor
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Other releases
  • Nette homepage
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Nette Framework (https://nette.org)
 5:  * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
 6:  */
 7: 
 8: namespace Nette\Iterators;
 9: 
10: use Nette;
11: 
12: 
13: /**
14:  * Applies the callback to the elements of the inner iterator.
15:  *
16:  * @author     David Grudl
17:  */
18: class Mapper extends \IteratorIterator
19: {
20:     /** @var callable */
21:     private $callback;
22: 
23: 
24:     public function __construct(\Traversable $iterator, $callback)
25:     {
26:         parent::__construct($iterator);
27:         $this->callback = new Nette\Callback($callback);
28:     }
29: 
30: 
31:     public function current()
32:     {
33:         return $this->callback->invoke(parent::current(), parent::key());
34:     }
35: 
36: }
37: 
Nette 2.0 API documentation generated by ApiGen 2.8.0