Class CMS_stack

Description

Class CMS_stack

Manages a stack. This stack is usually recorded into DB as a string and consists of a non-sorted stack of arrays. The arrays contains one or two values. It is decided when looking at the text definition or when adding the first element. The text definition format is : "key1,value1;key2,value2" for two-elements stacks "value1;value2" for one-elements stacks ---------------------------------------------------------- TODO : Completely remove this class from Automne This is a relicat from Automne v1 and this kind of data management is a pain in the ass but it is used in all oldest class Using native array functions of PHP is much more simple and fast. Seb

Located in /automne/classes/common/stack.php (line 38)

CMS_grandFather
   |
   --CMS_stack
Method Summary
 void add (mixed $value1, [mixed $value2 = false])
 void del (mixed $value1, [mixed $value2 = false])
 void delAllWithOneKey (mixed $key)
 void delAllWithOneValue (mixed $value, integer $position)
 void emptyStack ()
 array(array(mixed=>mixed)) getElements ()
 array(array(mixed=>mixed)) getElementsWithOneValue (mixed $value, integer $position)
 mixed, getElementValueFromKey (mixed $key)
 string getTextDefinition ()
 integer getValuesByAtom ()
 boolean setTextDefinition (string $text)
 void setValuesByAtom (integer $nElem)
Methods
add (line 111)

Adds an element to the array

  • access: public
void add (mixed $value1, [mixed $value2 = false])
  • mixed $value1: The mandatory value
  • mixed $value2: The optional value. Will be ignored if the stack is mono-value
del (line 132)

Deletes an element off the array

  • access: public
void del (mixed $value1, [mixed $value2 = false])
  • mixed $value1: The mandatory value we're looking to remove.
  • mixed $value2: The optional value of the element we're looking to remove. Will be ignored if it's a one-value stack.
delAllWithOneKey (line 156)

Deletes an element off the array that have the given key (at the first position)

  • access: public
void delAllWithOneKey (mixed $key)
  • mixed $key: The key we're looking to remove.
delAllWithOneValue (line 175)

Deletes all the elements off the array that have the given value at the position given.

  • access: public
void delAllWithOneValue (mixed $value, integer $position)
  • mixed $value: The value we're looking to remove.
  • integer $position: The position of the value we're looking to remove. Can be 1 or 2.
emptyStack (line 239)

Empties the stack.

  • access: public
void emptyStack ()
getElements (line 192)

Gets all the elements of the array.

  • return: the elements of the stack.
  • access: public
array(array(mixed=>mixed)) getElements ()
getElementsWithOneValue (line 222)

Gets all the elements of the array with the value given as the first or second value (depends of the position).

  • return: the elements of the stack matching the value at the position.
  • access: public
array(array(mixed=>mixed)) getElementsWithOneValue (mixed $value, integer $position)
  • mixed $value: The value we search for
  • integer $position: The position of the value in the array (1 or 2)
getElementValueFromKey (line 204)

Gets a value of first element corresponding to given key

  • return: the value of the stack matching the key given
  • access: public
mixed, getElementValueFromKey (mixed $key)
  • mixed $key: The key we're looking for value
getTextDefinition (line 59)

Get the text definition.

  • return: The text definition based on the current elements
  • access: public
string getTextDefinition ()
getValuesByAtom (line 263)

Gets values by atom.

  • access: public
integer getValuesByAtom ()
setTextDefinition (line 83)

Sets the text definition.

The string format is : "key1,value1;key2,value2" for two-values arrays "value1;value2" for one-value arrays

  • return: false on malformed string, true else.
  • access: private
boolean setTextDefinition (string $text)
  • string $text: The text definition.
setValuesByAtom (line 252)

Sets values by atom.

  • access: public
void setValuesByAtom (integer $nElem)
  • integer $nElem

Inherited Methods

Inherited From CMS_grandFather

 CMS_grandFather::autoload()
 CMS_grandFather::hasError()
 CMS_grandFather::log()
 CMS_grandFather::PHPErrorHandler()
 CMS_grandFather::raiseError()
 CMS_grandFather::setDebug()
 CMS_grandFather::setLog()
 CMS_grandFather::_raiseError()
 CMS_grandFather::__call()
Class Constants

Documentation generated on Wed, 15 Feb 2012 15:39:20 +0100 by phpDocumentor 1.4.3