feat: first impl
This commit is contained in:
32
src/Stdio.php
Normal file
32
src/Stdio.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Nih\CommandBuilder;
|
||||
|
||||
use Stringable;
|
||||
|
||||
abstract class Stdio
|
||||
{
|
||||
abstract public function getDescriptorSpec(): array;
|
||||
|
||||
public static function file(string|Stringable $file, string $mode): self
|
||||
{
|
||||
return new StdioFile((string) $file, $mode);
|
||||
}
|
||||
|
||||
public static function piped(string $mode): self
|
||||
{
|
||||
return new StdioPiped($mode);
|
||||
}
|
||||
|
||||
public static function inherit(): null
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function null(): self
|
||||
{
|
||||
return new StdioFile('/dev/null', 'a+');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user