abstract class OperationScaffolder implements ConfigurationApplier (View source)

Provides functionality common to both operation scaffolders. Cannot be a subclass due to their distinct inheritance chains.

Traits

Extensible

Methods

string
getDescription()

No description

setDescription(string $description)

No description

static string|null
getClassFromIdentifier(string $name)

No description

static string|null
getIdentifier(string|OperationScaffolder $instOrClass)

No description

static array
getOperations()

Gets a map of operation identifiers to their classes

__construct(string $operationName = null, string $typeName = null, OperationResolver|callable|null $resolver = null)

OperationScaffolder constructor.

$this
addArgs(array $argData)

Adds args to the operation

$this
addArg(string $argName, string $typeStr, string $description = null, mixed $defaultValue = null)

No description

$this
setArgDescriptions(array $argData)

Sets descriptions of arguments [ 'Email' => 'The email of the user' ]

$this
setArgDescription(string $argName, string $description)

Sets a single arg description

$this
setArgDefaults(array $argData)

Sets argument defaults [ 'Featured' => true ]

$this
setArgDefault(string $argName, mixed $default)

Sets a default for a single arg

$this
setArgsRequired(array $argData)

Sets operation arguments as required or not [ 'ID' => true ]

setArgRequired(string $argName, bool $required)

Sets an operation argument as required or not

string
getName()

No description

$this
setName(string $name)

No description

ArrayList
getArgs()

No description

$this
setTypeName(string $typeName)

Type name

string
getTypeName()

No description

$this
removeArg(string $arg)

No description

$this
removeArgs(array $args)

No description

getResolver()

No description

$this
setResolver(callable|OperationResolver|string $resolver)

No description

applyConfig(array $config)

No description

Details

$this setChainableParent(DataObjectScaffolder|SchemaScaffolder $parent)

Set parent

Parameters

DataObjectScaffolder|SchemaScaffolder $parent

Return Value

$this

string getDescription()

Return Value

string

OperationScaffolder setDescription(string $description)

Parameters

string $description

Return Value

OperationScaffolder

static string|null getClassFromIdentifier(string $name)

Parameters

string $name

Return Value

string|null

static string|null getIdentifier(string|OperationScaffolder $instOrClass)

Parameters

string|OperationScaffolder $instOrClass

Return Value

string|null

static array getOperations()

Gets a map of operation identifiers to their classes

Return Value

array

__construct(string $operationName = null, string $typeName = null, OperationResolver|callable|null $resolver = null)

OperationScaffolder constructor.

Parameters

string $operationName
string $typeName
OperationResolver|callable|null $resolver

$this addArgs(array $argData)

Adds args to the operation

Ex: [ 'MyArg' => 'String!', 'MyOtherArg' => 'Int', 'MyCustomArg' => new InputObjectType([ ]

Parameters

array $argData

Return Value

$this

$this addArg(string $argName, string $typeStr, string $description = null, mixed $defaultValue = null)

Parameters

string $argName
string $typeStr
string $description
mixed $defaultValue

Return Value

$this

$this setArgDescriptions(array $argData)

Sets descriptions of arguments [ 'Email' => 'The email of the user' ]

Parameters

array $argData

Return Value

$this

$this setArgDescription(string $argName, string $description)

Sets a single arg description

Parameters

string $argName
string $description

Return Value

$this

$this setArgDefaults(array $argData)

Sets argument defaults [ 'Featured' => true ]

Parameters

array $argData

Return Value

$this

$this setArgDefault(string $argName, mixed $default)

Sets a default for a single arg

Parameters

string $argName
mixed $default

Return Value

$this

$this setArgsRequired(array $argData)

Sets operation arguments as required or not [ 'ID' => true ]

Parameters

array $argData

Return Value

$this

OperationScaffolder setArgRequired(string $argName, bool $required)

Sets an operation argument as required or not

Parameters

string $argName
bool $required

Return Value

OperationScaffolder

string getName()

Return Value

string

$this setName(string $name)

Parameters

string $name

Return Value

$this

ArrayList getArgs()

Return Value

ArrayList

$this setTypeName(string $typeName)

Type name

Parameters

string $typeName

Return Value

$this

string getTypeName()

Return Value

string

$this removeArg(string $arg)

Parameters

string $arg

Return Value

$this

$this removeArgs(array $args)

Parameters

array $args

Return Value

$this

callable|OperationResolver getResolver()

Return Value

callable|OperationResolver

$this setResolver(callable|OperationResolver|string $resolver)

Parameters

callable|OperationResolver|string $resolver

Callable, instance of (or classname of) a OperationResolver

Return Value

$this

Exceptions

InvalidArgumentException

applyConfig(array $config)

Parameters

array $config

Exceptions

Exception