Packages

  • 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
  • PHP

Classes

  • GenericRecursiveIterator
  • InstanceFilterIterator
  • MapIterator
  • NCallbackFilterIterator
  • NRecursiveCallbackFilterIterator
  • SmartCachingIterator
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Nette Framework (http://nette.org)
 5:  *
 6:  * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
 7:  *
 8:  * For the full copyright and license information, please view
 9:  * the file license.txt that was distributed with this source code.
10:  * @package Nette\Iterators
11:  */
12: 
13: 
14: 
15: /**
16:  * Applies the callback to the elements of the inner iterator.
17:  *
18:  * @author     David Grudl
19:  * @package Nette\Iterators
20:  */
21: class MapIterator extends IteratorIterator
22: {
23:     /** @var callable */
24:     private $callback;
25: 
26: 
27:     public function __construct(Traversable $iterator, $callback)
28:     {
29:         parent::__construct($iterator);
30:         $this->callback = new Callback($callback);
31:     }
32: 
33: 
34: 
35:     public function current()
36:     {
37:         return $this->callback->invoke(parent::current(), parent::key());
38:     }
39: 
40: }
41: 
Nette Framework 2.0.7 (for PHP 5.2, un-prefixed) API API documentation generated by ApiGen 2.8.0