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

Commit

Permalink
CS fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Koopzington committed Nov 19, 2016
1 parent c15d1bd commit 14ce275
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 21 deletions.
28 changes: 28 additions & 0 deletions src/Figlet/Figlet.php
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,10 @@ public function render($text, $encoding = 'UTF-8')
* @param string $string The string to add to the output
* @return void
*/
// @codingStandardsIgnoreStart
protected function _putString($string)
{
// @codingStandardsIgnoreEnd
$length = strlen($string);

if ($this->outputWidth > 1) {
Expand All @@ -558,8 +560,10 @@ protected function _putString($string)
*
* @return void
*/
// @codingStandardsIgnoreStart
protected function _appendLine()
{
// @codingStandardsIgnoreEnd
for ($i = 0; $i < $this->charHeight; $i++) {
$this->_putString($this->outputLine[$i]);
}
Expand All @@ -574,8 +578,10 @@ protected function _appendLine()
*
* @return void
*/
// @codingStandardsIgnoreStart
protected function _splitLine()
{
// @codingStandardsIgnoreEnd
$gotSpace = false;
for ($i = ($this->inCharLineLength - 1); $i >= 0; $i--) {
if (! $gotSpace && $this->inCharLine[$i] === ' ') {
Expand Down Expand Up @@ -619,8 +625,10 @@ protected function _splitLine()
*
* @return void
*/
// @codingStandardsIgnoreStart
protected function _clearLine()
{
// @codingStandardsIgnoreEnd
for ($i = 0; $i < $this->charHeight; $i++) {
$this->outputLine[$i] = '';
}
Expand All @@ -636,8 +644,10 @@ protected function _clearLine()
* @param string $char Character which to add to the output
* @return bool
*/
// @codingStandardsIgnoreStart
protected function _addChar($char)
{
// @codingStandardsIgnoreEnd
$this->_getLetter($char);

if ($this->currentChar === null) {
Expand Down Expand Up @@ -693,8 +703,10 @@ protected function _addChar($char)
* @param string $char The character from which to get the letter of
* @return void
*/
// @codingStandardsIgnoreStart
protected function _getLetter($char)
{
// @codingStandardsIgnoreEnd
if (array_key_exists($this->_uniOrd($char), $this->charList)) {
$this->currentChar = $this->charList[$this->_uniOrd($char)];
$this->previousCharWidth = $this->currentCharWidth;
Expand All @@ -710,8 +722,10 @@ protected function _getLetter($char)
*
* @return int
*/
// @codingStandardsIgnoreStart
protected function _smushAmount()
{
// @codingStandardsIgnoreEnd
if (($this->smushMode & (self::SM_SMUSH | self::SM_KERN)) === 0) {
return 0;
}
Expand Down Expand Up @@ -818,8 +832,10 @@ protected function _smushAmount()
* @param string $rightChar Right character to smush
* @return string
*/
// @codingStandardsIgnoreStart
protected function _smushem($leftChar, $rightChar)
{
// @codingStandardsIgnoreEnd
if ($leftChar === ' ') {
return $rightChar;
}
Expand Down Expand Up @@ -944,8 +960,10 @@ protected function _smushem($leftChar, $rightChar)
* @throws Exception\UnexpectedValueException When font file is not a FIGlet 2 font file
* @return void
*/
// @codingStandardsIgnoreStart
protected function _loadFont($fontFile)
{
// @codingStandardsIgnoreEnd
// Check if the font file exists
if (! file_exists($fontFile)) {
throw new Exception\RuntimeException($fontFile . ': Font file not found');
Expand Down Expand Up @@ -1103,8 +1121,10 @@ protected function _loadFont($fontFile)
*
* @return void
*/
// @codingStandardsIgnoreStart
protected function _setUsedSmush()
{
// @codingStandardsIgnoreEnd
if ($this->smushOverride === self::SMO_NO) {
$this->smushMode = $this->fontSmush;
} elseif ($this->smushOverride === self::SMO_YES) {
Expand All @@ -1120,8 +1140,10 @@ protected function _setUsedSmush()
* @param resource $fp File pointer to the font file
* @return string
*/
// @codingStandardsIgnoreStart
protected function _readMagic($fp)
{
// @codingStandardsIgnoreEnd
$magic = '';

for ($i = 0; $i < 4; $i++) {
Expand All @@ -1137,8 +1159,10 @@ protected function _readMagic($fp)
* @param resource $fp File pointer to the font file
* @return void
*/
// @codingStandardsIgnoreStart
protected function _skipToEol($fp)
{
// @codingStandardsIgnoreEnd
$dummy = fgetc($fp);
while ($dummy !== false && ! feof($fp)) {
if ($dummy === "\n") {
Expand All @@ -1165,8 +1189,10 @@ protected function _skipToEol($fp)
* @param resource $fp File pointer to the font file
* @return array
*/
// @codingStandardsIgnoreStart
protected function _loadChar($fp)
{
// @codingStandardsIgnoreEnd
$char = [];

for ($i = 0; $i < $this->charHeight; $i++) {
Expand All @@ -1192,8 +1218,10 @@ protected function _loadChar($fp)
* @param string $c The char to get the value from
* @return int
*/
// @codingStandardsIgnoreStart
protected function _uniOrd($c)
{
// @codingStandardsIgnoreEnd
$h = ord($c[0]);

if ($h <= 0x7F) {
Expand Down
2 changes: 2 additions & 0 deletions src/Table/Decorator/Unicode.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,10 @@ public function getHorizontalUp()
* @param int $code
* @return string|false
*/
// @codingStandardsIgnoreStart
protected function _uniChar($code)
{
// @codingStandardsIgnoreEnd
if ($code <= 0x7F) {
$char = chr($code);
} elseif ($code <= 0x7FF) {
Expand Down
2 changes: 2 additions & 0 deletions test/FigletTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,10 @@ public function testEmptyString()
$this->assertEquals('', $figlet->render(''));
}

// @codingStandardsIgnoreStart
protected function _equalAgainstFile($output, $file)
{
// @codingStandardsIgnoreEnd
$compareString = file_get_contents(__DIR__ . '/Figlet/' . $file);

$this->assertEquals($compareString, $output);
Expand Down
69 changes: 48 additions & 21 deletions test/TableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,21 @@ public function testColumnSetAlignInvalidArgument()

public function testColumnSetColSpanInvalidArgument()
{
$this->setExpectedException('Zend\Text\Table\Exception\InvalidArgumentException', 'must be an integer and greater than 0');
$this->setExpectedException(
'Zend\Text\Table\Exception\InvalidArgumentException',
'must be an integer and greater than 0'
);
$column = new Table\Column(null, null, 0);
}

public function testColumnRenderInvalidArgument()
{
$column = new Table\Column();

$this->setExpectedException('Zend\Text\Table\Exception\InvalidArgumentException', 'must be an integer and greater than 0');
$this->setExpectedException(
'Zend\Text\Table\Exception\InvalidArgumentException',
'must be an integer and greater than 0'
);
$column->render(0);
}

Expand Down Expand Up @@ -207,7 +213,10 @@ public function testRowMultiLine()
$row->appendColumn(new Table\Column("foo\nbar"));
$row->appendColumn(new Table\Column("foobar"));

$this->assertEquals($row->render([10, 10], $decorator), "│foo │foobar │\n│bar │ │\n");
$this->assertEquals(
$row->render([10, 10], $decorator),
"│foo │foobar │\n│bar │ │\n"
);
}

public function testUnicodeRowMultiLine()
Expand All @@ -218,7 +227,10 @@ public function testUnicodeRowMultiLine()
$row->appendColumn(new Table\Column("föö\nbär"));
$row->appendColumn(new Table\Column("fööbär"));

$this->assertEquals($row->render([3, 10], $decorator), "│föö│fööbär │\n│bär│ │\n");
$this->assertEquals(
$row->render([3, 10], $decorator),
"│föö│fööbär │\n│bär│ │\n"
);
}

public function testTableConstructInvalidColumnWidthsItem()
Expand Down Expand Up @@ -270,7 +282,10 @@ public function testTableSimpleRow()
$row->createColumn('foobar');
$table->appendRow($row);

$this->assertEquals($table->render(), "┌──────────┐\n│foobar │\n└──────────┘\n");
$this->assertEquals(
$table->render(),
"┌──────────┐\n│foobar │\n└──────────┘\n"
);
}

public function testDefaultColumnAlign()
Expand All @@ -281,7 +296,10 @@ public function testDefaultColumnAlign()

$table->appendRow(['foobar']);

$this->assertEquals($table->render(), "┌──────────┐\n│ foobar │\n└──────────┘\n");
$this->assertEquals(
$table->render(),
"┌──────────┐\n│ foobar │\n└──────────┘\n"
);
}

public function testRowGetColumns()
Expand Down Expand Up @@ -330,11 +348,14 @@ public function testTableColSpanWithMultipleRows()
$row->appendColumn(new Table\Column('foobar', null, 2));
$table->appendRow($row);

$this->assertEquals($table->render(), "┌──────────┬──────────┐\n"
. "│foobar │foobar │\n"
. "├──────────┴──────────┤\n"
. "│foobar │\n"
. "└─────────────────────┘\n");
$this->assertEquals(
$table->render(),
"┌──────────┬──────────┐\n"
. "│foobar │foobar │\n"
. "├──────────┴──────────┤\n"
. "│foobar │\n"
. "└─────────────────────┘\n"
);
}

public function testTableComplex()
Expand All @@ -361,15 +382,18 @@ public function testTableComplex()
$row->appendColumn(new Table\Column('foobar'));
$table->appendRow($row);

$this->assertEquals($table->render(), "┌──────────┬─────────────────────┐\n"
. "│foobar │foobar │\n"
. "├──────────┼─────────────────────┤\n"
. "│foobar │foobar │\n"
. "├──────────┴─────────────────────┤\n"
. "│foobar │\n"
. "├──────────┬──────────┬──────────┤\n"
. "│foobar │foobar │foobar │\n"
. "└──────────┴──────────┴──────────┘\n");
$this->assertEquals(
$table->render(),
"┌──────────┬─────────────────────┐\n"
. "│foobar │foobar │\n"
. "├──────────┼─────────────────────┤\n"
. "│foobar │foobar │\n"
. "├──────────┴─────────────────────┤\n"
. "│foobar │\n"
. "├──────────┬──────────┬──────────┤\n"
. "│foobar │foobar │foobar │\n"
. "└──────────┴──────────┴──────────┘\n"
);
}

public function testTableMagicToString()
Expand All @@ -380,7 +404,10 @@ public function testTableMagicToString()
$row->appendColumn(new Table\Column('foobar'));
$table->appendRow($row);

$this->assertEquals((string) $table, "┌──────────┐\n│foobar │\n└──────────┘\n");
$this->assertEquals(
(string) $table,
"┌──────────┐\n│foobar │\n└──────────┘\n"
);
}

public function testDecoratorUnicode()
Expand Down

0 comments on commit 14ce275

Please sign in to comment.