Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
really finished all variable renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
tr committed Jul 27, 2012
1 parent cb6e0fd commit 635260d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
22 changes: 11 additions & 11 deletions src/Table/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,28 @@ class Column
*
* @var string
*/
protected $_content = '';
protected $content = '';

/**
* Align of the column
*
* @var string
*/
protected $_align = self::ALIGN_LEFT;
protected $align = self::ALIGN_LEFT;

/**
* Colspan of the column
*
* @var integer
*/
protected $_colSpan = 1;
protected $colSpan = 1;

/**
* Allowed align parameters
*
* @var array
*/
protected $_allowedAligns = array(self::ALIGN_LEFT, self::ALIGN_CENTER, self::ALIGN_RIGHT);
protected $allowedAligns = array(self::ALIGN_LEFT, self::ALIGN_CENTER, self::ALIGN_RIGHT);

/**
* Create a column for a Zend\Text\Table\Row object.
Expand Down Expand Up @@ -112,7 +112,7 @@ public function setContent($content, $charset = null)

}

$this->_content = $content;
$this->content = $content;

return $this;
}
Expand All @@ -126,11 +126,11 @@ public function setContent($content, $charset = null)
*/
public function setAlign($align)
{
if (in_array($align, $this->_allowedAligns) === false) {
if (in_array($align, $this->allowedAligns) === false) {
throw new Exception\OutOfBoundsException('Invalid align supplied');
}

$this->_align = $align;
$this->align = $align;

return $this;
}
Expand All @@ -148,7 +148,7 @@ public function setColSpan($colSpan)
throw new Exception\InvalidArgumentException('$colSpan must be an integer and greater than 0');
}

$this->_colSpan = $colSpan;
$this->colSpan = $colSpan;

return $this;
}
Expand All @@ -160,7 +160,7 @@ public function setColSpan($colSpan)
*/
public function getColSpan()
{
return $this->_colSpan;
return $this->colSpan;
}

/**
Expand All @@ -184,7 +184,7 @@ public function render($columnWidth, $padding = 0)
throw new Exception\OutOfBoundsException('Padding (' . $padding . ') is greater than column width');
}

switch ($this->_align) {
switch ($this->align) {
case self::ALIGN_LEFT:
$padMode = STR_PAD_RIGHT;
break;
Expand All @@ -203,7 +203,7 @@ public function render($columnWidth, $padding = 0)
}

$outputCharset = Table::getOutputCharset();
$lines = explode("\n", Text\MultiByte::wordWrap($this->_content, $columnWidth, "\n", true, $outputCharset));
$lines = explode("\n", Text\MultiByte::wordWrap($this->content, $columnWidth, "\n", true, $outputCharset));
$paddedLines = array();

foreach ($lines AS $line) {
Expand Down
28 changes: 14 additions & 14 deletions src/Table/Row.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ class Row
*
* @var array
*/
protected $_columns = array();
protected $columns = array();

/**
* Temporary stored column widths
*
* @var array
*/
protected $_columnWidths = null;
protected $columnWidths = null;

/**
* Create a new column and append it to the row
Expand Down Expand Up @@ -66,7 +66,7 @@ public function createColumn($content, array $options = null)
*/
public function appendColumn(Column $column)
{
$this->_columns[] = $column;
$this->columns[] = $column;

return $this;
}
Expand All @@ -81,11 +81,11 @@ public function appendColumn(Column $column)
*/
public function getColumn($index)
{
if (!isset($this->_columns[$index])) {
if (!isset($this->columns[$index])) {
return null;
}

return $this->_columns[$index];
return $this->columns[$index];
}

/**
Expand All @@ -95,7 +95,7 @@ public function getColumn($index)
*/
public function getColumns()
{
return $this->_columns;
return $this->columns;
}

/**
Expand All @@ -106,11 +106,11 @@ public function getColumns()
*/
public function getColumnWidths()
{
if ($this->_columnWidths === null) {
if ($this->columnWidths === null) {
throw new Exception\UnexpectedValueException('render() must be called before columnWidths can be populated');
}

return $this->_columnWidths;
return $this->columnWidths;
}

/**
Expand All @@ -125,19 +125,19 @@ public function getColumnWidths()
public function render(array $columnWidths, Decorator $decorator, $padding = 0)
{
// Prepare an array to store all column widths
$this->_columnWidths = array();
$this->columnWidths = array();

// If there is no single column, create a column which spans over the
// entire row
if (count($this->_columns) === 0) {
if (count($this->columns) === 0) {
$this->appendColumn(new Column(null, null, count($columnWidths)));
}

// First we have to render all columns, to get the maximum height
$renderedColumns = array();
$maxHeight = 0;
$colNum = 0;
foreach ($this->_columns as $column) {
foreach ($this->columns as $column) {
// Get the colspan of the column
$colSpan = $column->getColSpan();

Expand All @@ -155,7 +155,7 @@ public function render(array $columnWidths, Decorator $decorator, $padding = 0)
$result = explode("\n", $column->render($columnWidth, $padding));

// Store the width of the rendered column
$this->_columnWidths[] = $columnWidth;
$this->columnWidths[] = $columnWidth;

// Store the rendered column and calculate the new max height
$renderedColumns[] = $result;
Expand All @@ -173,7 +173,7 @@ public function render(array $columnWidths, Decorator $decorator, $padding = 0)
$colNum));
$renderedColumns[] = array(str_repeat(' ', $remainingWidth));

$this->_columnWidths[] = $remainingWidth;
$this->columnWidths[] = $remainingWidth;
}

// Add each single column line to the result
Expand All @@ -185,7 +185,7 @@ public function render(array $columnWidths, Decorator $decorator, $padding = 0)
if (isset($renderedColumn[$line]) === true) {
$result .= $renderedColumn[$line];
} else {
$result .= str_repeat(' ', $this->_columnWidths[$index]);
$result .= str_repeat(' ', $this->columnWidths[$index]);
}

$result .= $decorator->getVertical();
Expand Down

0 comments on commit 635260d

Please sign in to comment.