\Charcoal\App\ScriptArgScriptTrait

Additional utilities for handling arguments and inputs.

Summary

Methods
Properties
Constants
No public methods found
No public properties found
No constants found
parseAsArray()
parseArguments()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

parseAsArray()

parseAsArray(mixed  $var, string  $delimiter = '[\s,]+') : array|\Traversable

Resolve the given value as a collection of values.

If the given value is a string, it will be split.

Parameters

mixed $var

An argument to split.

string $delimiter

The boundary string.

Throws

\InvalidArgumentException

If the value cannot be parsed into an array.

Returns

array|\Traversable

parseArguments()

parseArguments() : self

Parse command line arguments into script properties.

Throws

\RuntimeException

If a checkbox/radio argument has no options.

Returns

self