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

Commit

Permalink
fix PHPCS errors for Zend\Text
Browse files Browse the repository at this point in the history
  • Loading branch information
UFOMelkor authored and Ocramius committed Dec 8, 2014
1 parent 3f3e42b commit 7be0b0e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 25 deletions.
23 changes: 12 additions & 11 deletions src/Figlet/Figlet.php
Original file line number Diff line number Diff line change
Expand Up @@ -954,8 +954,7 @@ protected function _loadFont($fontFile)
// Check if gzip support is required
if (substr($fontFile, -3) === '.gz') {
if (!function_exists('gzcompress')) {
throw new Exception\RuntimeException('GZIP library is required for '
. 'gzip compressed font files');
throw new Exception\RuntimeException('GZIP library is required for gzip compressed font files');
}

$fontFile = 'compress.zlib://' . $fontFile;
Expand All @@ -979,15 +978,17 @@ protected function _loadFont($fontFile)
$magic = $this->_readMagic($fp);

// Get the header
$numsRead = sscanf(fgets($fp, 1000),
'%*c%c %d %*d %d %d %d %d %d',
$this->hardBlank,
$this->charHeight,
$this->maxLength,
$smush,
$cmtLines,
$rightToLeft,
$this->fontSmush);
$numsRead = sscanf(
fgets($fp, 1000),
'%*c%c %d %*d %d %d %d %d %d',
$this->hardBlank,
$this->charHeight,
$this->maxLength,
$smush,
$cmtLines,
$rightToLeft,
$this->fontSmush
);

if ($magic !== self::FONTFILE_MAGIC_NUMBER || $numsRead < 5) {
throw new Exception\UnexpectedValueException($fontFile . ': Not a FIGlet 2 font file');
Expand Down
11 changes: 5 additions & 6 deletions src/Table/Row.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ public function getColumns()
public function getColumnWidths()
{
if ($this->columnWidths === null) {
throw new Exception\UnexpectedValueException('render() must be called before columnWidths can be populated');
throw new Exception\UnexpectedValueException(
'render() must be called before columnWidths can be populated'
);
}

return $this->columnWidths;
Expand Down Expand Up @@ -143,9 +145,7 @@ public function render(array $columnWidths, Decorator $decorator, $padding = 0)
}

// Calculate the column width
$columnWidth = ($colSpan - 1 + array_sum(array_slice($columnWidths,
$colNum,
$colSpan)));
$columnWidth = ($colSpan - 1 + array_sum(array_slice($columnWidths, $colNum, $colSpan)));

// Render the column and split it's lines into an array
$result = explode("\n", $column->render($columnWidth, $padding));
Expand All @@ -165,8 +165,7 @@ public function render(array $columnWidths, Decorator $decorator, $padding = 0)
// it with an empty column
if ($colNum < count($columnWidths)) {
$remainingWidth = (count($columnWidths) - $colNum - 1) +
array_sum(array_slice($columnWidths,
$colNum));
array_sum(array_slice($columnWidths, $colNum));
$renderedColumns[] = array(str_repeat(' ', $remainingWidth));

$this->columnWidths[] = $remainingWidth;
Expand Down
12 changes: 4 additions & 8 deletions src/Table/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ public function setColumnWidths(array $columnWidths)

foreach ($columnWidths as $columnNum => $columnWidth) {
if (is_int($columnWidth) === false or $columnWidth < 1) {
throw new Exception\InvalidArgumentException('Column ' . $columnNum . ' has an invalid'
. ' column width');
throw new Exception\InvalidArgumentException('Column ' . $columnNum . ' has an invalid column width');
}
}

Expand Down Expand Up @@ -375,8 +374,7 @@ public function render()
$result .= $this->decorator->getTopLeft();

foreach ($columnWidths as $columnNum => $columnWidth) {
$result .= str_repeat($this->decorator->getHorizontal(),
$columnWidth);
$result .= str_repeat($this->decorator->getHorizontal(), $columnWidth);

if (($columnNum + 1) === $numColumns) {
$result .= $this->decorator->getTopRight();
Expand Down Expand Up @@ -412,8 +410,7 @@ public function render()
// Loop through all column widths
foreach ($this->columnWidths as $columnNum => $columnWidth) {
// Add the horizontal line
$result .= str_repeat($this->decorator->getHorizontal(),
$columnWidth);
$result .= str_repeat($this->decorator->getHorizontal(), $columnWidth);

// If this is the last line, break out
if (($columnNum + 1) === $totalNumColumns) {
Expand Down Expand Up @@ -476,8 +473,7 @@ public function render()
$result .= $this->decorator->getBottomLeft();

foreach ($columnWidths as $columnNum => $columnWidth) {
$result .= str_repeat($this->decorator->getHorizontal(),
$columnWidth);
$result .= str_repeat($this->decorator->getHorizontal(), $columnWidth);

if (($columnNum + 1) === $numColumns) {
$result .= $this->decorator->getBottomRight();
Expand Down

0 comments on commit 7be0b0e

Please sign in to comment.