Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcConsoleTableRow

ConsoleTools::ezcConsoleTableRow

Class ezcConsoleTableRow

Structure representing a table row in ezcConsoleTable.

This class represents a row in a table object. You can access the properties of the row directly, but also access the cells of the row directly, as if the object was an array (index 0..).

  1.  // Create new table row
  2.  $row = new ezcConsoleTableRow();
  3.  
  4.  // Set default format of the row's cells
  5.  $row->format = 'headline';
  6.  
  7.  // On the fly create the cell no 0
  8.  $row[0]->content = 'Name';
  9.  // On the fly create the cell no 1
  10.  $row[1]->content = 'Cellphone';
  11.  
  12.  // Change a setting on cell 0
  13.  $row[0]->align = ezcConsoleTable::ALIGN_CENTER;
  14.  
  15.  // Iterate through the row's cells.
  16.  foreach ( $row as $cell )
  17.  {
  18.      var_dump( $cell );
  19.  }
  20.  
  21.  // Set the default align property for all cells in the row
  22.  $row->align = ezcConsoleTable::ALIGN_CENTER;

This class stores the rows for the ezcConsoleTable class.

Source for this file: /ConsoleTools/src/table/row.php

Implements interfaces:

  • Countable (internal interface)
  • Iterator (internal interface)
  • ArrayAccess (internal interface)
Version:   //autogen//

Properties

mixed read/write $align
Alignment applied to cells marked with ezcConsoleTable::ALIGN_DEFAULT.
string read/write $borderFormat
Set the format applied to the borders of this row. See ezcConsoleOutput
string read/write $format
Format applied to cell contents of cells marked with format "default" in this row.

Member Variables

protected array(ezcConsoleTableCell) $cells = array()
The cells of the row.
protected array(string=>mixed) $properties
Container to hold the properties

Method Summary

public ezcConsoleTableRow __construct( )
Create a new ezcConsoleProgressbarRow.
public int count( )
Returns the number of cells in the row.
public ezcConsoleTableCell current( )
Returns the currently selected cell.
public int key( )
Returns the key of the currently selected cell.
public mixed next( )
Returns the next cell and selects it or false on the last cell.
public bool offsetExists( $offset )
Returns if the given offset exists.
public ezcConsoleTableCell offsetGet( $offset )
Returns the element with the given offset.
public void offsetSet( $offset , $value )
Set the element with the given offset.
public void offsetUnset( $offset )
Unset the element with the given offset.
public ezcConsoleTableCell rewind( )
Selects the very first cell and returns it.
public ezcConsoleTableCell valid( )
Returns if the current cell is valid.

Methods

__construct

ezcConsoleTableRow __construct( )

Create a new ezcConsoleProgressbarRow.

Creates a new ezcConsoleProgressbarRow.

This method takes any number of ezcConsoleTableCell objects as parameter, which will be added as table cells to the row in their specified order.

Exceptions:
Type Description
ezcBaseValueException If a parameter is not of type ezcConsoleTableCell.

count

int count( )

Returns the number of cells in the row.

This method is part of the Countable interface to allow the usage of PHP's count() function to check how many cells this row has.

Implementation of:
Method Description
Countable::count

current

ezcConsoleTableCell current( )

Returns the currently selected cell.

This method is part of the Iterator interface to allow acces to the cells of this row by iterating over it like an array (e.g. using foreach).

Implementation of:
Method Description
Iterator::current

key

int key( )

Returns the key of the currently selected cell.

This method is part of the Iterator interface to allow acces to the cells of this row by iterating over it like an array (e.g. using foreach).

Implementation of:
Method Description
Iterator::key

next

mixed next( )

Returns the next cell and selects it or false on the last cell.

This method is part of the Iterator interface to allow acces to the cells of this row by iterating over it like an array (e.g. using foreach).

Implementation of:
Method Description
Iterator::next

offsetExists

bool offsetExists( int $offset )

Returns if the given offset exists.

This method is part of the ArrayAccess interface to allow access to the data of this object as if it was an array.

Parameters:
Name Type Description
$offset int The offset to check.
Exceptions:
Type Description
ezcBaseValueException If a non numeric cell ID is requested.
Implementation of:
Method Description
ArrayAccess::offsetExists

offsetGet

ezcConsoleTableCell offsetGet( int $offset )

Returns the element with the given offset.

This method is part of the ArrayAccess interface to allow access to the data of this object as if it was an array. In case of the ezcConsoleTableRow class this method always returns a valid cell object since it creates them on the fly, if a given item does not exist.

Parameters:
Name Type Description
$offset int The offset to check.
Exceptions:
Type Description
ezcBaseValueException If a non numeric cell ID is requested.
Implementation of:
Method Description
ArrayAccess::offsetGet

offsetSet

void offsetSet( int $offset , ezcConsoleTableCell $value )

Set the element with the given offset.

This method is part of the ArrayAccess interface to allow access to the data of this object as if it was an array.

Parameters:
Name Type Description
$offset int The offset to assign an item to.
$value ezcConsoleTableCell The cell to assign.
Exceptions:
Type Description
ezcBaseValueException If the provided value is not of type {@ling ezcConsoleTableCell}.
ezcBaseValueException If a non numeric cell ID is requested.
Implementation of:
Method Description
ArrayAccess::offsetSet

offsetUnset

void offsetUnset( int $offset )

Unset the element with the given offset.

This method is part of the ArrayAccess interface to allow access to the data of this object as if it was an array.

Parameters:
Name Type Description
$offset int The offset to unset the value for.
Exceptions:
Type Description
ezcBaseValueException If a non numeric cell ID is requested.
Implementation of:
Method Description
ArrayAccess::offsetUnset

rewind

Selects the very first cell and returns it.

This method is part of the Iterator interface to allow acces to the cells of this row by iterating over it like an array (e.g. using foreach).

Implementation of:
Method Description
Iterator::rewind

valid

Returns if the current cell is valid.

This method is part of the Iterator interface to allow acces to the cells of this row by iterating over it like an array (e.g. using foreach).

Implementation of:
Method Description
Iterator::valid
Documentation generated by phpDocumentor 1.4.3