Compare commits
8 Commits
87df94560f
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 6f19a04351 | |||
| 027eaf0fd7 | |||
| 72baddb9e2 | |||
| 22831b2055 | |||
| 7d969499f3 | |||
| 13ebd2ceb6 | |||
| c3973332fb | |||
| f94755d8b1 |
@@ -0,0 +1,3 @@
|
|||||||
|
composer.lock
|
||||||
|
/nbproject/
|
||||||
|
/vendor/
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"name": "potter/console",
|
||||||
|
"type": "library",
|
||||||
|
"license": "MIT",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Potter\\Console\\": "src/Potter/Console/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Jay Potter",
|
||||||
|
"email": "j@ypotter.ca"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"minimum-stability": "stable",
|
||||||
|
"require": {
|
||||||
|
"potter/container": ">=0.0.1",
|
||||||
|
"psr/container": ">=2.0.2",
|
||||||
|
"symfony/console": ">=8.1.4",
|
||||||
|
"symfony/deprecation-contracts": ">=3.7.1",
|
||||||
|
"symfony/polyfill-ctype": ">=1.37.0",
|
||||||
|
"symfony/polyfill-intl-grapheme": ">=1.41.0",
|
||||||
|
"symfony/polyfill-intl-normalizer": ">=1.38.0",
|
||||||
|
"symfony/polyfill-mbstring": ">=1.38.2",
|
||||||
|
"symfony/polyfill-php85": ">=1.41.0",
|
||||||
|
"symfony/service-contracts": ">=3.7.1",
|
||||||
|
"symfony/string": ">=8.1.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
{ }
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Potter\Console;
|
||||||
|
|
||||||
|
final class Output extends \Symfony\Component\Console\Output\ConsoleOutput
|
||||||
|
{ }
|
||||||
Reference in New Issue
Block a user