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

Classes

  • CachingIterator
  • Filter
  • InstanceFilter
  • Mapper
  • RecursiveFilter
  • Recursor
  • Overview
  • Namespace
  • 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:  */
11: 
12: namespace Nette\Iterators;
13: 
14: use Nette;
15: 
16: 
17: 
18: /**
19:  * Callback recursive iterator filter.
20:  *
21:  * @author     David Grudl
22:  */
23: class RecursiveFilter extends \FilterIterator implements \RecursiveIterator
24: {
25:     /** @var callback */
26:     private $callback;
27: 
28:     /** @var callback */
29:     private $childrenCallback;
30: 
31: 
32:     /**
33:      * Constructs a filter around another iterator.
34:      * @param
35:      * @param  callback
36:      */
37:     public function __construct(\RecursiveIterator $iterator, $callback, $childrenCallback = NULL)
38:     {
39:         parent::__construct($iterator);
40:         $this->callback = $callback;
41:         $this->childrenCallback = $childrenCallback;
42:     }
43: 
44: 
45: 
46:     public function accept()
47:     {
48:         return $this->callback === NULL || call_user_func($this->callback, $this);
49:     }
50: 
51: 
52: 
53:     public function hasChildren()
54:     {
55:         return $this->getInnerIterator()->hasChildren()
56:             && ($this->childrenCallback === NULL || call_user_func($this->childrenCallback, $this));
57:     }
58: 
59: 
60: 
61:     public function getChildren()
62:     {
63:         return new static($this->getInnerIterator()->getChildren(), $this->callback, $this->childrenCallback);
64:     }
65: 
66: }
67: 
Nette Framework 2.0.0 API API documentation generated by ApiGen 2.7.0