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:  * Instance iterator filter.
17:  *
18:  * @author     David Grudl
19:  * @package Nette\Iterators
20:  */
21: class NInstanceFilterIterator extends FilterIterator implements Countable
22: {
23:     /** @var string */
24:     private $type;
25: 
26: 
27:     /**
28:      * Constructs a filter around another iterator.
29:      * @param  Iterator
30:      * @param  string  class/interface name
31:      */
32:     public function __construct(Iterator $iterator, $type)
33:     {
34:         $this->type = $type;
35:         parent::__construct($iterator);
36:     }
37: 
38: 
39: 
40:     /**
41:      * Expose the current element of the inner iterator?
42:      * @return bool
43:      */
44:     public function accept()
45:     {
46:         return $this->current() instanceof $this->type;
47:     }
48: 
49: 
50: 
51:     /**
52:      * Returns the count of elements.
53:      * @return int
54:      */
55:     public function count()
56:     {
57:         return iterator_count($this);
58:     }
59: 
60: }
61: 
Nette Framework 2.0.1 (for PHP 5.2, prefixed) API API documentation generated by ApiGen 2.7.0