POT
POT
POT
Main menu

Download

Forum

SVN

Class: OTS_Container

Source Location: /classes/OTS_Container.php

Class OTS_Container

Class Overview

Implements interfaces:

  • IteratorAggregate (internal interface)

Container item representation.

Container item representation. This class represents items that can contain other items. It's count() method has been overwritten so it now doesn't return count of current item (if it would even be possible for containers) but amount of items within (not recursively).

Located in /classes/OTS_Container.php [line 26]

OTS_Item
   |
   --OTS_Container
Author(s):
Information Tags:
Version:  0.1.3
Version:  0.0.3
Since:  0.0.3

Methods

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From OTS_Item

OTS_Item::__construct()
Creates item of given ID.
OTS_Item::count()
Count value for current item.
OTS_Item::getAttributes()
Returns item custom attributes.
OTS_Item::getCount()
Returns count of item.
OTS_Item::getId()
Returns item type.
OTS_Item::getItemType()
Returns type of item.
OTS_Item::setAttributes()
Sets item attributes.
OTS_Item::setCount()
Sets count of item.
OTS_Item::__get()
Magic PHP5 method.
OTS_Item::__set()
Magic PHP5 method.

[ Top ]
Method Summary
void   addItem()   Adds item to container.
int   count()   Number of items inside container.
OTS_Item   current()  
ArrayIterator   getIterator()   Returns iterator handle for loops.
mixed   key()  
void   next()  
void   removeItem()   Removes given item from current container.
void   rewind()  
bool   valid()  
void   __clone()   Clones all contained items.

[ Top ]
Methods
addItem  [line 40]

  void addItem( OTS_Item $item  )

Adds item to container.

Adds item to container.

Parameters:
OTS_Item   $item:  Item.

API Tags:
Access:  public

Information Tags:
Version:  0.0.3
Since:  0.0.3

[ Top ]
count  [line 76]

  int count( )

Number of items inside container.

Number of items inside container. OTS_Container implementation of Countable interface differs from OTS_Item implemention. OTS_Item::count() returns count of given item, OTS_Container::count() returns number of items inside container. If somehow it would be possible to make container items with more then 1 in one place, you can use OTS_Item::getCount() and OTS_Item::setCount() in code where you are not sure if working with regular item, or container.


API Tags:
Return:  Number of items.
Access:  public

Information Tags:
Version:  0.0.3
Since:  0.0.3

Redefinition of:
OTS_Item::count()
Count value for current item.

[ Top ]
current  [line 85]

  OTS_Item current( )


API Tags:
Return:  Current item.
Deprecated:  0.1.0 Use getIterator().
Access:  public

Information Tags:
Version:  0.0.3
Since:  0.0.3

[ Top ]
getIterator  [line 131]

  ArrayIterator getIterator( )

Returns iterator handle for loops.

Returns iterator handle for loops.


API Tags:
Return:  Items iterator.
Access:  public

Information Tags:
Version:  0.1.0
Version:  0.0.3
Since:  0.0.3
Since:  0.1.0

Implementation of:
IteratorAggregate::getIterator

[ Top ]
key  [line 102]

  mixed key( )


API Tags:
Return:  Iterator position.
Deprecated:  0.1.0 Use getIterator().
Access:  public

Information Tags:
Version:  0.0.3
Since:  0.0.3

[ Top ]
next  [line 93]

  void next( )


API Tags:
Deprecated:  0.1.0 Use getIterator().
Access:  public

Information Tags:
Version:  0.0.3
Since:  0.0.3

[ Top ]
removeItem  [line 55]

  void removeItem( OTS_Item $item  )

Removes given item from current container.

Removes given item from current container. Passed item must be exacly instance of item which is stored in container, not it's copy. This method bases on PHP references.

Parameters:
OTS_Item   $item:  Item.

API Tags:
Access:  public

Information Tags:
Tutorial:  Players
Version:  0.0.3
Since:  0.0.3

[ Top ]
rewind  [line 119]

  void rewind( )


API Tags:
Deprecated:  0.1.0 Use getIterator().
Access:  public

Information Tags:
Version:  0.0.3
Since:  0.0.3

[ Top ]
valid  [line 111]

  bool valid( )


API Tags:
Return:  Does next item exist.
Deprecated:  0.1.0 Use getIterator().
Access:  public

Information Tags:
Version:  0.0.3
Since:  0.0.3

[ Top ]
__clone  [line 142]

  void __clone( )

Clones all contained items.

Clones all contained items.


API Tags:
Access:  public

Information Tags:
Version:  0.1.3
Version:  0.0.3
Since:  0.0.3
Since:  0.1.3

[ Top ]