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..).
- // Create new table row
- // Set default format of the row's cells
- $row->format = 'headline';
- // On the fly create the cell no 0
- $row[0]->content = 'Name';
- // On the fly create the cell no 1
- $row[1]->content = 'Cellphone';
- // Change a setting on cell 0
- // Iterate through the row's cells.
- foreach ( $row as $cell )
- {
- }
- // Set the default align property for all cells in the row
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
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
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
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
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
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
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
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
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
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 |