-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #337 from sensiolabs-de/improve-console-output-for…
…matter introduce table output formatter
- Loading branch information
Showing
24 changed files
with
761 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,6 @@ ruleset: | |
- Layer1 | ||
Layer1: | ||
- Layer2 | ||
skip_violations: | ||
examples\Layer2\SomeOtherClass: | ||
- examples\Layer1\SomeClass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SensioLabs\Deptrac\Console; | ||
|
||
interface Output | ||
{ | ||
public function writeFormatted(string $message): void; | ||
|
||
public function writeLineFormatted(string $message): void; | ||
|
||
public function writeRaw(string $message): void; | ||
|
||
public function getStyle(): OutputStyle; | ||
|
||
public function isVerbose(): bool; | ||
|
||
public function isDebug(): bool; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SensioLabs\Deptrac\Console; | ||
|
||
use Symfony\Component\Console\Helper\TableSeparator; | ||
|
||
interface OutputStyle | ||
{ | ||
public function title(string $message): void; | ||
|
||
public function section(string $message): void; | ||
|
||
public function success(string $message): void; | ||
|
||
public function error(string $message): void; | ||
|
||
public function warning(string $message): void; | ||
|
||
public function note(string $message): void; | ||
|
||
public function caution(string $message): void; | ||
|
||
/** | ||
* @param string|array|TableSeparator ...$list | ||
*/ | ||
public function definitionList(...$list): void; | ||
|
||
/** | ||
* @param mixed[] $headers | ||
* @param mixed[] $rows | ||
*/ | ||
public function table(array $headers, array $rows): void; | ||
|
||
public function newLine(int $count = 1): void; | ||
|
||
public function progressStart(int $max = 0): void; | ||
|
||
public function progressAdvance(int $step = 1): void; | ||
|
||
public function progressFinish(): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SensioLabs\Deptrac\Console\Symfony; | ||
|
||
use SensioLabs\Deptrac\Console\OutputStyle; | ||
use Symfony\Component\Console\Style\SymfonyStyle; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
class Style implements OutputStyle | ||
{ | ||
private $symfonyStyle; | ||
|
||
public function __construct(SymfonyStyle $symfonyStyle) | ||
{ | ||
$this->symfonyStyle = $symfonyStyle; | ||
} | ||
|
||
public function title(string $message): void | ||
{ | ||
$this->symfonyStyle->title($message); | ||
} | ||
|
||
public function section(string $message): void | ||
{ | ||
$this->symfonyStyle->section($message); | ||
} | ||
|
||
public function success(string $message): void | ||
{ | ||
$this->symfonyStyle->success($message); | ||
} | ||
|
||
public function error(string $message): void | ||
{ | ||
$this->symfonyStyle->error($message); | ||
} | ||
|
||
public function warning(string $message): void | ||
{ | ||
$this->symfonyStyle->warning($message); | ||
} | ||
|
||
public function note(string $message): void | ||
{ | ||
$this->symfonyStyle->note($message); | ||
} | ||
|
||
public function caution(string $message): void | ||
{ | ||
$this->symfonyStyle->caution($message); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function definitionList(...$list): void | ||
{ | ||
$this->symfonyStyle->definitionList(...$list); | ||
} | ||
|
||
public function table(array $headers, array $rows): void | ||
{ | ||
$this->symfonyStyle->table($headers, $rows); | ||
} | ||
|
||
public function newLine(int $count = 1): void | ||
{ | ||
$this->symfonyStyle->newLine($count); | ||
} | ||
|
||
public function progressStart(int $max = 0): void | ||
{ | ||
$this->symfonyStyle->progressStart($max); | ||
} | ||
|
||
public function progressAdvance(int $step = 1): void | ||
{ | ||
$this->symfonyStyle->progressAdvance($step); | ||
} | ||
|
||
public function progressFinish(): void | ||
{ | ||
$this->symfonyStyle->progressFinish(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SensioLabs\Deptrac\Console\Symfony; | ||
|
||
use SensioLabs\Deptrac\Console\Output; | ||
use SensioLabs\Deptrac\Console\OutputStyle; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
class SymfonyOutput implements Output | ||
{ | ||
private $symfonyOutput; | ||
private $style; | ||
|
||
public function __construct( | ||
OutputInterface $symfonyOutput, | ||
OutputStyle $style | ||
) { | ||
$this->symfonyOutput = $symfonyOutput; | ||
$this->style = $style; | ||
} | ||
|
||
public function writeFormatted(string $message): void | ||
{ | ||
$this->symfonyOutput->write($message, false, OutputInterface::OUTPUT_NORMAL); | ||
} | ||
|
||
public function writeLineFormatted(string $message): void | ||
{ | ||
$this->symfonyOutput->writeln($message, OutputInterface::OUTPUT_NORMAL); | ||
} | ||
|
||
public function writeRaw(string $message): void | ||
{ | ||
$this->symfonyOutput->write($message, false, OutputInterface::OUTPUT_RAW); | ||
} | ||
|
||
public function getStyle(): OutputStyle | ||
{ | ||
return $this->style; | ||
} | ||
|
||
public function isVerbose(): bool | ||
{ | ||
return $this->symfonyOutput->isVerbose(); | ||
} | ||
|
||
public function isDebug(): bool | ||
{ | ||
return $this->symfonyOutput->isDebug(); | ||
} | ||
} |
Oops, something went wrong.