mirror of
https://github.com/rekryt/iplist.git
synced 2025-10-13 16:59:36 +03:00
Initial commit
This commit is contained in:
20
src/Infrastructure/Task/ShellTask.php
Normal file
20
src/Infrastructure/Task/ShellTask.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace OpenCCK\Infrastructure\Task;
|
||||
|
||||
use Amp\Cancellation;
|
||||
use Amp\Sync\Channel;
|
||||
|
||||
readonly class ShellTask implements TaskInterface {
|
||||
public function __construct(private string $command) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Channel $channel
|
||||
* @param Cancellation $cancellation
|
||||
* @return string
|
||||
*/
|
||||
public function run(Channel $channel, Cancellation $cancellation): mixed {
|
||||
return shell_exec($this->command);
|
||||
}
|
||||
}
|
11
src/Infrastructure/Task/TaskInterface.php
Normal file
11
src/Infrastructure/Task/TaskInterface.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace OpenCCK\Infrastructure\Task;
|
||||
|
||||
use Amp\Cancellation;
|
||||
use Amp\Parallel\Worker\Task;
|
||||
use Amp\Sync\Channel;
|
||||
|
||||
interface TaskInterface extends Task {
|
||||
public function run(Channel $channel, Cancellation $cancellation): mixed;
|
||||
}
|
Reference in New Issue
Block a user