Compare commits
4 Commits
7d969499f3
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 6f19a04351 | |||
| 027eaf0fd7 | |||
| 72baddb9e2 | |||
| 22831b2055 |
@@ -15,6 +15,7 @@
|
|||||||
],
|
],
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"require": {
|
"require": {
|
||||||
|
"potter/container": ">=0.0.1",
|
||||||
"psr/container": ">=2.0.2",
|
"psr/container": ">=2.0.2",
|
||||||
"symfony/console": ">=8.1.4",
|
"symfony/console": ">=8.1.4",
|
||||||
"symfony/deprecation-contracts": ">=3.7.1",
|
"symfony/deprecation-contracts": ">=3.7.1",
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Potter\Console;
|
||||||
|
|
||||||
|
use \Potter\Container;
|
||||||
|
|
||||||
|
trait Behaviour
|
||||||
|
{
|
||||||
|
private static function addConsoleBehaviour(Container $container): void
|
||||||
|
{
|
||||||
|
self::addConsoleLogger($container);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function addConsoleLogger(Container $container): void
|
||||||
|
{
|
||||||
|
if ($container->has(Logger::class)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
self::addConsoleOutput($container);
|
||||||
|
$container->addShared(Logger::class)
|
||||||
|
->addArgument(Output::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function addConsoleOutput(Container $container): void
|
||||||
|
{
|
||||||
|
if ($container->has(Output::class)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$container->addShared(Output::class)
|
||||||
|
->addArgument(Output::VERBOSITY_VERY_VERBOSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Potter\Console;
|
||||||
|
|
||||||
|
final class Logger extends \Symfony\Component\Console\Logger\ConsoleLogger
|
||||||
|
{ }
|
||||||
Reference in New Issue
Block a user