Phpcraft
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
Phpcraft\Command\ArgumentProvider Class Reference
Inheritance diagram for Phpcraft\Command\ArgumentProvider:
Inheritance graph
[legend]

Public Member Functions

 __construct (CommandSender &$sender, string $arg)
 
 getValue ()
 
 acceptsMore ()
 
 isFinished ()
 
 acceptNext (string $arg)
 

Static Public Member Functions

static noop ()
 
static write (Connection $con)
 
static read (Connection $con)
 

Protected Attributes

 $value
 

Detailed Description

Extend this class to create a custom argument provider for Commands. All declared classes will automagically be scanned and if they extends this class, it will be registered as the provider of the type that their getValue function returns. User input will be given to the constructor, if it is invalid for your type, simply throw a DomainException or similar. Should the type you're providing require more than one "word", feel free to override isFinished and acceptNext.

Constructor & Destructor Documentation

◆ __construct()

Phpcraft\Command\ArgumentProvider::__construct ( CommandSender $sender,
string  $arg 
)
abstract

Member Function Documentation

◆ acceptNext()

Phpcraft\Command\ArgumentProvider::acceptNext ( string  $arg)
Parameters
string$arg
Returns
void

Reimplemented in Phpcraft\Command\QuotedStringProvider, and Phpcraft\Command\GreedyStringProvider.

◆ acceptsMore()

Phpcraft\Command\ArgumentProvider::acceptsMore ( )

◆ getValue()

Phpcraft\Command\ArgumentProvider::getValue ( )
abstract

◆ isFinished()

Phpcraft\Command\ArgumentProvider::isFinished ( )
Returns
bool

Reimplemented in Phpcraft\Command\QuotedStringProvider.

◆ noop()

static Phpcraft\Command\ArgumentProvider::noop ( )
static

Does nothing and shouldn't do anything. This function is called on "native" argument providers by Command so they are forced into existence.

Returns
void

◆ read()

static Phpcraft\Command\ArgumentProvider::read ( Connection  $con)
static
Parameters
Connection$con
Returns
string
Exceptions
IOException

◆ write()

static Phpcraft\Command\ArgumentProvider::write ( Connection  $con)
static

Member Data Documentation

◆ $value

Phpcraft\Command\ArgumentProvider::$value
protected