Documentation


SEARCH

TABLE OF CONTENT

    1. Getting started 2. Basic concepts 3. Request dispatching 4. Context container 5. Dual MVC 6. Component model: 7. Security 8. Configuration 9. Session handling 10. I18n 11. Cache 12. Logging 13. Error handling 14. Advanced Topics 15. API reference

      Tutorials: Frequently Asqued Questions

      See also:


      Class: __Collection


      Class Overview

      Base class for collections.

      
      
      				

      Properties

      Methods

      [ Top ]

      Direct descendents

      Child Class Description
      __FlowAttributesCollection This file is part of lion framework.
      __AnnotationsCollection An specific collection subclass for annotations
      __PropertiesCollection Collection of properties to set to context instances.
      __ConstructorArgumentsCollection Collection of arguments used to call a context instance constructor
      __ModelMap This file is part of lion framework.

      [ Top ]

      Properties Summary

      mixed   $_collection  
      string   $_iterator_class   This variable stores the class name of the iterator to be returned by the getIterator method

      [ Top ]

      Method Summary

      void   add()   This method adds an item in the collection.
      void   clear()   Removes all elements on current collection
      integer   count()   This method returns the number of elements contained in the collection
      bollean   del()   This method delete an item from the collection
      void   fromArray()   Populates the current collection from a given array of items Note: This method does not call internally to the add method for each item
      mixed   &get()   This method retrieves an element from the collection
      Traversable   &getIterator()   This method returns an iterator for the collection.
      boolean   hasKey()   This method check if a key exists in the collection
      void   keys()  
      void   offsetExists()  
      void   offsetGet()  
      void   offsetSet()  
      void   offsetUnset()  
      void   sort()  
      array   &toArray()   Returns an array with all items contained in the current collection

      [ Top ]

      Properties

      mixed   $_collection = array()
      Access:  protected


      string   $_iterator_class = '__Iterator'
      This variable stores the class name of the iterator to be returned by the getIterator method

      Access:  protected


      Methods

      add


        void add( mixed &$item, [mixed $key = null]  )

      This method adds an item in the collection.

      If a key is specified, the item is able to be identified by this key. If no keys are specified, this method has the same behaviour as Append.



      Parameters:
      TypeNameDescription
      mixed &$item The item to add to the collection
      mixed $key A key to identify the item in the collection

      Access:  public



      clear


        void clear( )

      Removes all elements on current collection

      Access:  public



      count


        integer count( )

      This method returns the number of elements contained in the collection

      Return:  The number of elements contained in the collection
      Access:  public



      del


        bollean del( mixed $index  )

      This method delete an item from the collection


      Parameters:
      TypeNameDescription
      mixed $index The index or key that identify the item to delete

      Return:  true if the item has been found and delete, else false
      Access:  public



      fromArray


        void fromArray( &$items, array $items  )

      Populates the current collection from a given array of items Note: This method does not call internally to the add method for each item


      Parameters:
      TypeNameDescription
      &$items
      array $items

      Access:  public



      get


        mixed &get( mixed $index  )

      This method retrieves an element from the collection


      Parameters:
      TypeNameDescription
      mixed $index The index or key that identify the item to be retrieved

      Return:  The requested item
      Access:  public



      getIterator


        Traversable &getIterator( )

      This method returns an iterator for the collection.

      If this method is not overrided, it will return an instance of _iterator_class (if _iterator_class has been setted and is correct).


      Return:  An iterator for the collection
      Access:  public



      hasKey


        boolean hasKey( string $index  )

      This method check if a key exists in the collection


      Parameters:
      TypeNameDescription
      string $index The key to check

      Return:  true if the key exists in the collection, else false
      Access:  public



      keys


        void keys( )

      Access:  public



      offsetExists


        void offsetExists( $offset  )


      Parameters:
      TypeNameDescription
      $offset

      Access:  public



      offsetGet


        void offsetGet( $offset  )


      Parameters:
      TypeNameDescription
      $offset

      Access:  public



      offsetSet


        void offsetSet( $offset, $value  )


      Parameters:
      TypeNameDescription
      $offset
      $value

      Access:  public



      offsetUnset


        void offsetUnset( $offset  )


      Parameters:
      TypeNameDescription
      $offset

      Access:  public



      sort


        void sort( $cmp_function  )


      Parameters:
      TypeNameDescription
      $cmp_function

      Access:  public



      toArray


        array &toArray( )

      Returns an array with all items contained in the current collection

      Access:  public


      Redefined in descendants as: