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

  • NGenericRecursiveIterator
  • NInstanceFilterIterator
  • NMapIterator
  • NNCallbackFilterIterator
  • NNRecursiveCallbackFilterIterator
  • NSmartCachingIterator
  • Overview
  • Package
  • Class
  • Tree
 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:  * Callback recursive iterator filter.
17:  *
18:  * @author     David Grudl
19:  * @package Nette\Iterators
20:  */
21: class NNRecursiveCallbackFilterIterator extends FilterIterator implements RecursiveIterator
22: {
23:     /** @var callback */
24:     private $callback;
25: 
26:     /** @var callback */
27:     private $childrenCallback;
28: 
29: 
30:     /**
31:      * Constructs a filter around another iterator.
32:      * @param
33:      * @param  callback
34:      */
35:     public function __construct(RecursiveIterator $iterator, $callback, $childrenCallback = NULL)
36:     {
37:         parent::__construct($iterator);
38:         $this->callback = $callback;
39:         $this->childrenCallback = $childrenCallback;
40:     }
41: 
42: 
43: 
44:     public function accept()
45:     {
46:         return $this->callback === NULL || call_user_func($this->callback, $this);
47:     }
48: 
49: 
50: 
51:     public function hasChildren()
52:     {
53:         return $this->getInnerIterator()->hasChildren()
54:             && ($this->childrenCallback === NULL || call_user_func($this->childrenCallback, $this));
55:     }
56: 
57: 
58: 
59:     public function getChildren()
60:     {
61:         return new self($this->getInnerIterator()->getChildren(), $this->callback, $this->childrenCallback);
62:     }
63: 
64: }
65: 
Nette Framework 2.0.0 (for PHP 5.2, prefixed) API API documentation generated by ApiGen 2.7.0