Namespaces

  • Nette
    • Application
    • Caching
    • Collections
    • Config
    • Forms
    • IO
    • Loaders
    • Mail
    • Reflection
    • Security
    • Templates
    • Web
  • None
  • PHP

Classes

  • ArrayTools
  • Callback
  • Component
  • ComponentContainer
  • Configurator
  • DateTime
  • Debug
  • Environment
  • Framework
  • FreezableObject
  • GenericRecursiveIterator
  • Image
  • ImageMagick
  • InstanceFilterIterator
  • Object
  • ObjectMixin
  • Paginator
  • RecursiveComponentIterator
  • ServiceLocator
  • SmartCachingIterator
  • String
  • Tools

Interfaces

  • IComponent
  • IComponentContainer
  • IDebuggable
  • IServiceLocator
  • ITranslator

Exceptions

  • AmbiguousServiceException
  • Overview
  • Namespace
  • Class
  • Tree
  • Other releases
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Nette Framework (https://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;
13: 
14: use Nette;
15: 
16: 
17: 
18: /**
19:  * Instance iterator filter.
20:  *
21:  * @author     David Grudl
22:  */
23: class InstanceFilterIterator extends \FilterIterator implements \Countable
24: {
25:     /** @var string */
26:     private $type;
27: 
28: 
29:     /**
30:      * Constructs a filter around another iterator.
31:      * @param  Iterator
32:      * @param  string  class/interface name
33:      */
34:     public function __construct(\Iterator $iterator, $type)
35:     {
36:         $this->type = $type;
37:         parent::__construct($iterator);
38:     }
39: 
40: 
41: 
42:     /**
43:      * Expose the current element of the inner iterator?
44:      * @return bool
45:      */
46:     public function accept()
47:     {
48:         return $this->current() instanceof $this->type;
49:     }
50: 
51: 
52: 
53:     /**
54:      * Returns the count of elements.
55:      * @return int
56:      */
57:     public function count()
58:     {
59:         return iterator_count($this);
60:     }
61: 
62: }
63: 
Nette Framework 0.9.7 API documentation generated by ApiGen 2.3.0