POT
POT
POT
Main menu

Download

Forum

SVN

Class: OTS_MonstersList

Source Location: /classes/OTS_MonstersList.php

Class OTS_MonstersList

Class Overview

Implements interfaces:

  • Iterator (internal interface)
  • Countable (internal interface)
  • ArrayAccess (internal interface)

Wrapper for monsters list.

Wrapper for monsters list.

Located in /classes/OTS_MonstersList.php [line 23]



		
				Author(s):
		
Information Tags:
Tutorial:  data/ directory resources
Version:  0.1.0
Version:  0.1.3
Since:  0.1.0

Methods

[ Top ]
Method Summary
OTS_MonstersList   __construct()   Loads monsters mapping file.
int   count()   Returns amount of monsters loaded.
OTS_Monster   current()   Returns monster at current position in iterator.
OTS_Monster   getMonster()   Returns loaded data of given monster.
bool   hasMonster()   Checks if given monster ID exists on list.
string   key()   Returns name of current position.
void   next()   Moves to next iterator monster.
bool   offsetExists()   Checks if given element exists.
OTS_Monster   offsetGet()   Returns item from given position.
void   offsetSet()   This method is implemented for ArrayAccess interface.
void   offsetUnset()   This method is implemented for ArrayAccess interface.
void   rewind()   Resets iterator index.
bool   valid()   Checks if there is anything more in interator.
void   __set_state()   Magic PHP5 method.
string   __toString()   Returns string representation of object.

[ Top ]
Methods
Constructor __construct  [line 49]

  OTS_MonstersList __construct( string $path  )

Loads monsters mapping file.

Loads monsters mapping file. Note: You pass directory path, not monsters.xml file name itself.

Parameters:
string   $path:  Monsters directory.

API Tags:
Access:  public

Information Tags:
Version:  0.1.0
Throws:  DOMException On DOM operation error.
Since:  0.1.0

[ Top ]
count  [line 131]

  int count( )

Returns amount of monsters loaded.

Returns amount of monsters loaded.


API Tags:
Return:  Count of monsters.
Access:  public

Information Tags:
Version:  0.1.0
Since:  0.1.0

Implementation of:
Countable::count

[ Top ]
current  [line 142]

  OTS_Monster current( )

Returns monster at current position in iterator.

Returns monster at current position in iterator.


API Tags:
Return:  Monster.
Access:  public

Information Tags:
Version:  0.1.0
Throws:  DOMException On DOM operation error.
Since:  0.1.0

Implementation of:
Iterator::current

[ Top ]
getMonster  [line 112]

  OTS_Monster getMonster( string $name  )

Returns loaded data of given monster.

Returns loaded data of given monster.

Parameters:
string   $name:  Monster name.

API Tags:
Return:  Monster data.
Access:  public

Information Tags:
Version:  0.1.3
Version:  0.1.0
Throws:  OutOfBoundsException If not exists.
Since:  0.1.0
Throws:  DOMException On DOM operation error.

[ Top ]
hasMonster  [line 98]

  bool hasMonster( string $name  )

Checks if given monster ID exists on list.

Checks if given monster ID exists on list.

Parameters:
string   $name:  Monster name.

API Tags:
Return:  If monster is set then true.
Access:  public

Information Tags:
Version:  0.1.3
Version:  0.1.0
Since:  0.1.0
Since:  0.1.3

[ Top ]
key  [line 160]

  string key( )

Returns name of current position.

Returns name of current position.


API Tags:
Return:  Current position key.
Access:  public

Information Tags:
Version:  0.1.0
Since:  0.1.0

Implementation of:
Iterator::key

[ Top ]
next  [line 150]

  void next( )

Moves to next iterator monster.

Moves to next iterator monster.


API Tags:
Access:  public

Information Tags:
Version:  0.1.0
Since:  0.1.0

Implementation of:
Iterator::next

[ Top ]
offsetExists  [line 189]

  bool offsetExists( string $offset  )

Checks if given element exists.

Checks if given element exists.

Parameters:
string   $offset:  Array key.

API Tags:
Return:  True if it's set.
Access:  public

Information Tags:
Version:  0.1.0
Since:  0.1.0

Implementation of:
ArrayAccess::offsetExists

[ Top ]
offsetGet  [line 202]

  OTS_Monster offsetGet( string $offset  )

Returns item from given position.

Returns item from given position.

Parameters:
string   $offset:  Array key.

API Tags:
Return:  Monster instance.
Access:  public

Information Tags:
Version:  0.1.3
Version:  0.1.0
Throws:  DOMException On DOM operation error.
Since:  0.1.0

Implementation of:
ArrayAccess::offsetGet

[ Top ]
offsetSet  [line 214]

  void offsetSet( string|int $offset, mixed $value  )

This method is implemented for ArrayAccess interface.

This method is implemented for ArrayAccess interface. In fact you can't write/append to monsters list. Any call to this method will cause E_OTS_ReadOnly raise.

Parameters:
string|int   $offset:  Array key.
mixed   $value:  Field value.

API Tags:
Access:  public

Information Tags:
Version:  0.1.0
Throws:  E_OTS_ReadOnly Always - this class is read-only.
Since:  0.1.0

Implementation of:
ArrayAccess::offsetSet

[ Top ]
offsetUnset  [line 225]

  void offsetUnset( string|int $offset  )

This method is implemented for ArrayAccess interface.

This method is implemented for ArrayAccess interface. In fact you can't write/append to monsters list. Any call to this method will cause E_OTS_ReadOnly raise.

Parameters:
string|int   $offset:  Array key.

API Tags:
Access:  public

Information Tags:
Version:  0.1.0
Throws:  E_OTS_ReadOnly Always - this class is read-only.
Since:  0.1.0

Implementation of:
ArrayAccess::offsetUnset

[ Top ]
rewind  [line 178]

  void rewind( )

Resets iterator index.

Resets iterator index.


API Tags:
Access:  public

Information Tags:
Version:  0.1.0
Since:  0.1.0

Implementation of:
Iterator::rewind

[ Top ]
valid  [line 170]

  bool valid( )

Checks if there is anything more in interator.

Checks if there is anything more in interator.


API Tags:
Return:  If iterator has anything more.
Access:  public

Information Tags:
Version:  0.1.0
Since:  0.1.0

Implementation of:
Iterator::valid

[ Top ]
__set_state  [line 77]

  void __set_state( array $properties  )

Magic PHP5 method.

Magic PHP5 method. Allows object importing from var_export().

Parameters:
array   $properties:  List of object properties.

API Tags:
Access:  public

Information Tags:
Version:  0.1.0
Since:  0.1.0

[ Top ]
__toString  [line 241]

  string __toString( )

Returns string representation of object.

Returns string representation of object. If any display driver is currently loaded then it uses it's method.


API Tags:
Return:  String representation of object.
Access:  public

Information Tags:
Version:  0.1.3
Version:  0.1.0
Since:  0.1.0
Since:  0.1.3

[ Top ]