-
Notifications
You must be signed in to change notification settings - Fork 1
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 #17 from 21TORR/port-v2
- Loading branch information
Showing
27 changed files
with
833 additions
and
179 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
1.x to 2.0 | ||
========== | ||
|
||
* All your messages need to extend `Task` now. | ||
* `TaskManager::enqueue()` now only accepts `Task`s. | ||
* `RegisterTasksEvent::registerTask()` was removed, you should use `RegisterTasksEvent::register(Task $task)`. |
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 |
---|---|---|
@@ -1,2 +1,8 @@ | ||
includes: | ||
- vendor/21torr/janus/phpstan/lib.neon | ||
- vendor/21torr/janus/phpstan/lib.neon | ||
|
||
# If you use simple-phpunit, you need to uncomment the following line. | ||
# Always make sure to first run simple-phpunit and then PHPStan. | ||
# parameters: | ||
# bootstrapFiles: | ||
# - vendor/bin/.phpunit/phpunit/vendor/autoload.php |
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
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,132 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Torr\TaskManager\Console; | ||
|
||
use Symfony\Component\Console\Formatter\OutputFormatterInterface; | ||
use Symfony\Component\Console\Output\BufferedOutput; | ||
use Symfony\Component\Console\Output\ConsoleOutput; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
final readonly class ChainOutput implements OutputInterface | ||
{ | ||
private ConsoleOutput $consoleOutput; | ||
private BufferedOutput $bufferedOutput; | ||
|
||
/** | ||
*/ | ||
public function __construct ( | ||
int $verbosity = self::VERBOSITY_NORMAL, | ||
bool $decorated = true, | ||
?OutputFormatterInterface $formatter = null, | ||
) | ||
{ | ||
$this->bufferedOutput = new BufferedOutput($verbosity, $decorated, $formatter); | ||
$this->consoleOutput = new ConsoleOutput($verbosity, $decorated, $formatter); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function write (iterable|string $messages, bool $newline = false, int $options = 0) : void | ||
{ | ||
$this->bufferedOutput->write($messages, $newline, $options); | ||
$this->consoleOutput->write($messages, $newline, $options); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function writeln (iterable|string $messages, int $options = 0) : void | ||
{ | ||
$this->bufferedOutput->writeln($messages, $options); | ||
$this->consoleOutput->writeln($messages, $options); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function setVerbosity (int $level) : void | ||
{ | ||
$this->bufferedOutput->setVerbosity($level); | ||
$this->consoleOutput->setVerbosity($level); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getVerbosity () : int | ||
{ | ||
return $this->bufferedOutput->getVerbosity(); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function isQuiet () : bool | ||
{ | ||
return $this->bufferedOutput->isQuiet(); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function isVerbose () : bool | ||
{ | ||
return $this->bufferedOutput->isVerbose(); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function isVeryVerbose () : bool | ||
{ | ||
return $this->bufferedOutput->isVeryVerbose(); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function isDebug () : bool | ||
{ | ||
return $this->bufferedOutput->isDebug(); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function setDecorated (bool $decorated) : void | ||
{ | ||
$this->bufferedOutput->setDecorated(true); | ||
$this->consoleOutput->setDecorated(true); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function isDecorated () : bool | ||
{ | ||
return $this->bufferedOutput->isDecorated(); | ||
} | ||
|
||
public function setFormatter (OutputFormatterInterface $formatter) : void | ||
{ | ||
$this->bufferedOutput->setFormatter($formatter); | ||
$this->consoleOutput->setFormatter($formatter); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getFormatter () : OutputFormatterInterface | ||
{ | ||
return $this->bufferedOutput->getFormatter(); | ||
} | ||
|
||
/** | ||
* | ||
*/ | ||
public function getBufferedOutput () : string | ||
{ | ||
return $this->bufferedOutput->fetch(); | ||
} | ||
} |
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,31 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Torr\TaskManager\Console; | ||
|
||
use Symfony\Component\Console\Input\ArrayInput; | ||
use Torr\Cli\Console\Style\TorrStyle; | ||
|
||
final class MessageHandlerIo extends TorrStyle | ||
{ | ||
private readonly ChainOutput $output; | ||
|
||
/** | ||
*/ | ||
public function __construct () | ||
{ | ||
$this->output = new ChainOutput(); | ||
|
||
parent::__construct( | ||
new ArrayInput([]), | ||
$this->output, | ||
); | ||
} | ||
|
||
/** | ||
* | ||
*/ | ||
public function getBufferedOutput () : string | ||
{ | ||
return $this->output->getBufferedOutput(); | ||
} | ||
} |
Oops, something went wrong.