mirror of
https://github.com/n3w/helpers-cli-input.git
synced 2025-12-20 21:23:24 +00:00
Initial commit
This commit is contained in:
commit
0620d00f08
24 changed files with 1054 additions and 0 deletions
26
src/Input/Interfaces/InputHandlerInterface.php
Normal file
26
src/Input/Interfaces/InputHandlerInterface.php
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pointybeard\Helpers\Cli\Input\Interfaces;
|
||||
|
||||
use pointybeard\Helpers\Cli\Input;
|
||||
|
||||
interface InputHandlerInterface
|
||||
{
|
||||
public function bind(Input\InputCollection $inputCollection, bool $skipValidation = false): bool;
|
||||
|
||||
public function validate(): void;
|
||||
|
||||
public function getArgument(string $name): ?string;
|
||||
|
||||
// note that the return value of getOption() isn't always going to be
|
||||
// a string like getArgument()
|
||||
public function getOption(string $name);
|
||||
|
||||
public function getArguments(): array;
|
||||
|
||||
public function getOptions(): array;
|
||||
|
||||
public function getCollection(): ?Input\InputCollection;
|
||||
}
|
||||
19
src/Input/Interfaces/InputTypeInterface.php
Normal file
19
src/Input/Interfaces/InputTypeInterface.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pointybeard\Helpers\Cli\Input\Interfaces;
|
||||
|
||||
interface InputTypeInterface
|
||||
{
|
||||
const FLAG_REQUIRED = 0x0001;
|
||||
const FLAG_OPTIONAL = 0x0002;
|
||||
const FLAG_VALUE_REQUIRED = 0x0004;
|
||||
const FLAG_VALUE_OPTIONAL = 0x0008;
|
||||
|
||||
const FLAG_TYPE_STRING = 0x0100;
|
||||
const FLAG_TYPE_INT = 0x0200;
|
||||
const FLAG_TYPE_INCREMENTING = 0x0400;
|
||||
|
||||
public function getType(): string;
|
||||
}
|
||||
12
src/Input/Interfaces/InputValidatorInterface.php
Normal file
12
src/Input/Interfaces/InputValidatorInterface.php
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pointybeard\Helpers\Cli\Input\Interfaces;
|
||||
|
||||
use pointybeard\Helpers\Cli\Input;
|
||||
|
||||
interface InputValidatorInterface
|
||||
{
|
||||
public function validate(Input\AbstractInputType $input, Input\AbstractInputHandler $context);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue