Author: Raymond Bosman
Date: 2006-12-21 12:13:26 +0100 (Thu, 21 Dec 2006)
New Revision: 4428
Log:
- Updated doc blocks.
Modified:
trunk/Template/src/cursor.php
trunk/Template/src/cycle.php
Modified: trunk/Template/src/cursor.php
===================================================================
--- trunk/Template/src/cursor.php 2006-12-21 10:55:14 UTC (rev 4427)
+++ trunk/Template/src/cursor.php 2006-12-21 11:13:26 UTC (rev 4428)
@@ -236,10 +236,12 @@
* Moves the cursor to the specified position.
*
* @see atBeginning(), atEnd()
+ *
+ * @param int $endPosition
* @throws ezcTemplateCursorsException if the position is beyond the text.
* @return void
*/
- function gotoPosition( $endPosition )
+ public function gotoPosition( $endPosition )
{
if ( $endPosition > strlen( $this->text ) )
throw new ezcTemplateCursorsException();
Modified: trunk/Template/src/cycle.php
===================================================================
--- trunk/Template/src/cycle.php 2006-12-21 10:55:14 UTC (rev 4427)
+++ trunk/Template/src/cycle.php 2006-12-21 11:13:26 UTC (rev 4428)
@@ -10,7 +10,10 @@
*/
/**
- * Cycle class.
+ * This class is the implementation of the cycle variable inside a template.
+ * At the declaration of a new cycle variable, a new ezcTemplateCycle object
+ * is created. Everywhere the cycle is used furthermore, it calls implicitly
the
+ * __set() and __get() methods via any property-call (usually ->v).
*
* @package Template
* @version //autogen//
@@ -18,15 +21,40 @@
*/
class ezcTemplateCycle
{
+ /**
+ * The value that the cycle currently contains.
+ *
+ * @var array(mixed)|false
+ */
private $value = false;
+ /**
+ * An internal pointer to the current element in the cycle array: $value.
+ *
+ * @var int
+ */
private $counter = 0;
+
+ /**
+ * Keeps track of the size of the cycle array: $value.
+ *
+ * @var int $size
+ */
private $size;
+
public function __construct()
{
}
+ /**
+ * For any property name it will set the ezcTemplateCycle::value to the
+ * given $value.
+ *
+ * @param string $name Value will be ignored.
+ * @param array(mixed) $value If not an array is assigned, it will set
the value to false.
+ * @return void
+ */
public function __set( $name, $value )
{
if ( is_array( $value ) )
@@ -40,6 +68,13 @@
$this->value = false;
}
+ /**
+ * Return the current array element it is pointing to. The property
+ * name $name is ignored.
+ *
+ * @param string $name Value will be ignored.
+ * @return mixed Returns the current array element it is pointing
to.
+ */
public function __get( $name )
{
if ( $this->value !== false )
@@ -52,16 +87,33 @@
throw new ezcTemplateInternalException("Invalid cycle: " . $name );
}
+ /**
+ * Increment the internal array element pointer. If it goes outside the
array
+ * boundaries, the pointer will be set to the first element.
+ *
+ * @return void
+ */
public function increment()
{
$this->counter = ++$this->counter % $this->size;
}
+ /**
+ * Increment the internal array element pointer. If it goes outside the
array
+ * boundaries, the pointer will be set to the last element.
+ *
+ * @return void
+ */
public function decrement()
{
if ( --$this->counter < 0 ) $this->counter = $this->size - 1;
}
+ /**
+ * Set the internal pointer to the first array element.
+ * @return void
+ *
+ */
public function reset()
{
$this->counter = 0;
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components