Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob
  • Smarty
    • Cacher
    • Compiler
    • Config
    • Debug
    • PluginsBlock
    • PluginsFilter
    • PluginsFunction
    • PluginsInternal
    • PluginsModifier
    • PluginsModifierCompiler
    • PluginsShared
    • Security
    • Template
    • TemplateResources
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • Swift_FailoverTransport
  • Swift_LoadBalancedTransport
  • Swift_MailTransport
  • Swift_Plugins_Loggers_ArrayLogger
  • Swift_Plugins_Loggers_EchoLogger
  • Swift_SendmailTransport
  • Swift_SmtpTransport
  • Swift_Transport_AbstractSmtpTransport
  • Swift_Transport_Esmtp_Auth_CramMd5Authenticator
  • Swift_Transport_Esmtp_Auth_LoginAuthenticator
  • Swift_Transport_Esmtp_Auth_PlainAuthenticator
  • Swift_Transport_Esmtp_AuthHandler
  • Swift_Transport_EsmtpTransport
  • Swift_Transport_FailoverTransport
  • Swift_Transport_LoadBalancedTransport
  • Swift_Transport_MailTransport
  • Swift_Transport_SendmailTransport
  • Swift_Transport_SimpleMailInvoker
  • Swift_Transport_StreamBuffer

Interfaces

  • Swift_Plugins_Logger
  • Swift_Plugins_Pop_Pop3Exception
  • Swift_Transport
  • Swift_Transport_Esmtp_Authenticator
  • Swift_Transport_EsmtpHandler
  • Swift_Transport_IoBuffer
  • Swift_Transport_MailInvoker
  • Swift_Transport_SmtpAgent
  • Swift_TransportException
  • Overview
  • Package
  • Function
  • Todo
  • Download
  1: <?php
  2: /**
  3:  * This file contains the iterator class.
  4:  *
  5:  * @package Core
  6:  * @subpackage Util
  7:  * @version SVN Revision $Rev:$
  8:  *
  9:  * @author Unknown
 10:  * @copyright four for business AG <www.4fb.de>
 11:  * @license http://www.contenido.org/license/LIZENZ.txt
 12:  * @link http://www.4fb.de
 13:  * @link http://www.contenido.org
 14:  */
 15: 
 16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 17: 
 18: /**
 19:  * cIterator: A class which represents the C/C++/JAVA Iterator support.
 20:  *
 21:  * Iterating items is a mechanism to "step" trough a list of defined items.
 22:  * Basically, the iterator is similar to an array, but provides easy functions
 23:  * to step trough the list.
 24:  *
 25:  * An instance of an iterator is usually created by a class returning multiple
 26:  * items and automatically filled using the $aItems parameter of the
 27:  * constructor,
 28:  * and then returned to the caller.
 29:  *
 30:  * The caller receives the iterator object and can step trough all items using
 31:  * the "next" method.
 32:  *
 33:  * @todo Add more stepping methods, as well as retrieving items
 34:  *
 35:  * @package Core
 36:  * @subpackage Util
 37:  */
 38: class cIterator {
 39: 
 40:     /**
 41:      * Holds the items which should be iterated
 42:      *
 43:      * @var array
 44:      */
 45:     var $_aIteratorItems;
 46: 
 47:     /**
 48:      * Iterator constructor
 49:      *
 50:      * This function initializes the constructor, adds the passed items
 51:      * and moves the iterator to the first element.
 52:      *
 53:      * @param array $aItems Items to add
 54:      */
 55:     public function __construct($aItems) {
 56:         if (is_array($aItems)) {
 57:             $this->_aIteratorItems = $aItems;
 58:         } else {
 59:             $this->_aIteratorItems = array();
 60:         }
 61: 
 62:         $this->reset();
 63:     }
 64: 
 65:     /**
 66:      * reset: Resets the iterator to the first element
 67:      *
 68:      * This function moves the iterator to the first element
 69:      */
 70:     public function reset() {
 71:         reset($this->_aIteratorItems);
 72:     }
 73: 
 74:     /**
 75:      * next: Returns the next item in the iterator
 76:      *
 77:      * This function returns the item, or false if no
 78:      * items are left.
 79:      *
 80:      * @return mixed item or false if nothing was found
 81:      */
 82:     public function next() {
 83:         $item = each($this->_aIteratorItems);
 84: 
 85:         if ($item === false) {
 86:             return false;
 87:         } else {
 88:             return $item["value"];
 89:         }
 90:     }
 91: 
 92:     /**
 93:      * count: Returns the number of items in the iterator
 94:      *
 95:      * @return int Number of items
 96:      */
 97:     public function count() {
 98:         return count($this->_aIteratorItems);
 99:     }
100: }
101: 
102: ?>
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen