Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
0c653a0
added console style guide helpers
kbond Sep 25, 2014
b2bd430
added FormatterInterface and default formatters
kbond Sep 25, 2014
c71222f
added warning result bar
kbond Sep 25, 2014
e20283f
added OutputDecorator
kbond Sep 25, 2014
797a485
added comments
kbond Sep 25, 2014
c1c49c8
adjusted some formats
kbond Sep 25, 2014
bdb3704
added newline helper
kbond Sep 25, 2014
7110316
FormatterInterface::format returns string only
kbond Sep 25, 2014
4b30f14
fix cs
kbond Sep 25, 2014
a358431
fix string padding
kbond Sep 25, 2014
99ebf0e
refactored and simplified
kbond Sep 26, 2014
4d3e078
rename subtitle to section, fix docblocks
kbond Oct 2, 2014
72708d7
refactored
kbond Oct 2, 2014
a59fe02
added table helper
kbond Oct 2, 2014
bafefd6
added question helpers
kbond Oct 2, 2014
d767d28
added style guide table style
kbond Oct 2, 2014
273c187
added StandardQuestionHelper
kbond Oct 2, 2014
b0d2e6a
added table style to Table defaults
kbond Oct 2, 2014
9d82d6a
added `askHidden` helper
kbond Oct 2, 2014
525be2b
fix cs
kbond Oct 2, 2014
16ad7b9
refactored, removed FormatterInterface
kbond Oct 3, 2014
de14472
match current style guide
kbond Oct 3, 2014
d4d6f52
added vertical padding for blocks
kbond Oct 3, 2014
a33d8a7
various fixes
kbond Oct 3, 2014
18dbdb3
revert changes to FormatterHelper
kbond Mar 25, 2015
ae6d7a7
ensure formatter helper exists in QuestionHelper::writeError()
kbond Mar 26, 2015
5c774cc
simplify style tag
kbond Mar 26, 2015
c36189a
rename StyleInterface::ln() to StyleInterface:newLine()
kbond Mar 26, 2015
85cc04c
add StyleInterface::progress()
kbond Mar 26, 2015
e0efaa8
fix bug
kbond Mar 26, 2015
91941f8
add OutputStyle::progressStart, progressAdvance, progressFinish
kbond Mar 26, 2015
8143e77
remove StyleInterface::multipleChoice()
kbond Mar 26, 2015
f0cb90a
set custom progressbar characters only in non-windows environments
kbond Mar 27, 2015
bbdb37c
use DIRECTORY_SEPARATOR to detect Windows
kbond Mar 27, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactored
  • Loading branch information
kbond committed Mar 25, 2015
commit 72708d7a86fe733eeb63e164cd668156b9e4eaed
115 changes: 115 additions & 0 deletions src/Symfony/Component/Console/Style/AbstractOutputStyle.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Console\Style;

use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
* Decorates output to add console style guide helper methods
*
* @author Kevin Bond <[email protected]>
*/
abstract class AbstractOutputStyle implements OutputInterface
{
private $output;

/**
* @param OutputInterface $output
*/
public function __construct(OutputInterface $output)
{
$this->output = $output;
}

/**
* @param FormatterInterface $formatter
*/
public function format(FormatterInterface $formatter)
{
$this->writeln($formatter->format());
}

/**
* Add newline(s)
*
* @param int $count The number of newlines
*/
public function ln($count = 1)
{
$this->output->write(str_repeat(PHP_EOL, $count));
}

/**
* {@inheritdoc}
*/
public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
{
$this->output->write($messages, $newline, $type);
}

/**
* {@inheritdoc}
*/
public function writeln($messages, $type = self::OUTPUT_NORMAL)
{
$this->output->writeln($messages, $type);
}

/**
* {@inheritdoc}
*/
public function setVerbosity($level)
{
$this->output->setVerbosity($level);
}

/**
* {@inheritdoc}
*/
public function getVerbosity()
{
return $this->output->getVerbosity();
}

/**
* {@inheritdoc}
*/
public function setDecorated($decorated)
{
$this->output->setDecorated($decorated);
}

/**
* {@inheritdoc}
*/
public function isDecorated()
{
return $this->output->isDecorated();
}

/**
* {@inheritdoc}
*/
public function setFormatter(OutputFormatterInterface $formatter)
{
$this->output->setFormatter($formatter);
}

/**
* {@inheritdoc}
*/
public function getFormatter()
{
return $this->output->getFormatter();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Component\Console\Helper\Formatter;
namespace Symfony\Component\Console\Style;

/**
* @author Kevin Bond <[email protected]>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
* file that was distributed with this source code.
*/

namespace Symfony\Component\Console\Helper\Formatter;
namespace Symfony\Component\Console\Style\Standard;

use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Helper\Helper;
use Symfony\Component\Console\Style\FormatterInterface;

/**
* Formats a message as a block of text.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
* file that was distributed with this source code.
*/

namespace Symfony\Component\Console\Helper\Formatter;
namespace Symfony\Component\Console\Style\Standard;

use Symfony\Component\Console\Style\FormatterInterface;

/**
* Formats a list element
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,15 @@
* file that was distributed with this source code.
*/

namespace Symfony\Component\Console\Output;
namespace Symfony\Component\Console\Style\Standard;

use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\Console\Helper\Formatter\BlockFormatter;
use Symfony\Component\Console\Helper\Formatter\FormatterInterface;
use Symfony\Component\Console\Helper\Formatter\ListFormatter;
use Symfony\Component\Console\Helper\Formatter\TextFormatter;
use Symfony\Component\Console\Helper\Formatter\TitleFormatter;
use Symfony\Component\Console\Style\AbstractOutputStyle;

/**
* Decorates output to add console style guide helper methods
*
* @author Kevin Bond <[email protected]>
*/
class OutputDecorator implements OutputInterface
class StandardOutputStyle extends AbstractOutputStyle
{
private $output;

/**
* @param OutputInterface $output
*/
public function __construct(OutputInterface $output)
{
$this->output = $output;
}

/**
* @param FormatterInterface $formatter
*/
public function format(FormatterInterface $formatter)
{
$this->writeln($formatter->format());
}

/**
* Formats a message as a block of text.
*
Expand Down Expand Up @@ -145,78 +120,5 @@ public function caution($messages)
{
$this->format(new BlockFormatter($messages, 'CAUTION', 'fg=white;bg=red', ' ! '));
}

/**
* Add newline(s)
*
* @param int $count The number of newlines
*/
public function ln($count = 1)
{
$this->output->write(str_repeat(PHP_EOL, $count));
}

/**
* {@inheritdoc}
*/
public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
{
$this->output->write($messages, $newline, $type);
}

/**
* {@inheritdoc}
*/
public function writeln($messages, $type = self::OUTPUT_NORMAL)
{
$this->output->writeln($messages, $type);
}

/**
* {@inheritdoc}
*/
public function setVerbosity($level)
{
$this->output->setVerbosity($level);
}

/**
* {@inheritdoc}
*/
public function getVerbosity()
{
return $this->output->getVerbosity();
}

/**
* {@inheritdoc}
*/
public function setDecorated($decorated)
{
$this->output->setDecorated($decorated);
}

/**
* {@inheritdoc}
*/
public function isDecorated()
{
return $this->output->isDecorated();
}

/**
* {@inheritdoc}
*/
public function setFormatter(OutputFormatterInterface $formatter)
{
$this->output->setFormatter($formatter);
}

/**
* {@inheritdoc}
*/
public function getFormatter()
{
return $this->output->getFormatter();
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
* file that was distributed with this source code.
*/

namespace Symfony\Component\Console\Helper\Formatter;
namespace Symfony\Component\Console\Style\Standard;

use Symfony\Component\Console\Style\FormatterInterface;

/**
* Formats informational text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
* file that was distributed with this source code.
*/

namespace Symfony\Component\Console\Helper\Formatter;
namespace Symfony\Component\Console\Style\Standard;

use Symfony\Component\Console\Style\FormatterInterface;

/**
* Formats a command title
Expand Down