Methods summary
public
|
#
__construct( array $data = array(), Guzzle\Service\Description\ServiceDescriptionInterface $description = null )
Create a new Parameter using an associative array of data. The array can contain the following information:
- name: (string) Unique name of the parameter
- type: (string|array) Type of variable (string, number, integer, boolean, object, array, numeric,
null, any). Types are using for validation and determining the structure of a parameter. You
can use a union type by providing an array of simple types. If one of the union types matches
the provided value, then the value is valid.
- instanceOf: (string) When the type is an object, you can specify the class that the object must implement
- required: (bool) Whether or not the parameter is required
- default: (mixed) Default value to use if no value is supplied
- static: (bool) Set to true to specify that the parameter value cannot be changed from the default
- description: (string) Documentation of the parameter
- location: (string) The location of a request used to apply a parameter. Custom locations can be registered
with a command, but the defaults are uri, query, header, body, json, xml, postField, postFile.
- sentAs: (string) Specifies how the data being modeled is sent over the wire. For example, you may wish
to include certain headers in a response model that have a normalized casing of FooBar, but the
actual header is x-foo-bar. In this case, sentAs would be set to x-foo-bar.
- filters: (array) Array of static method names to to run a parameter value through. Each value in the
array must be a string containing the full class path to a static method or an array of complex
filter information. You can specify static methods of classes using the full namespace class
name followed by '::' (e.g. Foo\Bar::baz()). Some filters require arguments in order to properly
filter a value. For complex filters, use a hash containing a 'method' key pointing to a static
method, and an 'args' key containing an array of positional arguments to pass to the method.
Arguments can contain keywords that are replaced when filtering a value: '@value' is replaced
with the value being validated, '@api' is replaced with the Parameter object.
- properties: When the type is an object, you can specify nested parameters
- additionalProperties: (array) This attribute defines a schema for all properties that are not explicitly
defined in an object type definition. If specified, the value MUST be a schema or a boolean. If
false is provided, no additional properties are allowed beyond the properties defined in the
schema. The default value is an empty schema which allows any value for additional properties.
- items: This attribute defines the allowed items in an instance array, and MUST be a schema or an array
of schemas. The default value is an empty schema which allows any value for items in the
instance array.
When this attribute value is a schema and the instance value is an array, then all the items
in the array MUST be valid according to the schema.
- pattern: When the type is a string, you can specify the regex pattern that a value must match
- enum: When the type is a string, you can specify a list of acceptable values
- minItems: (int) Minimum number of items allowed in an array
- maxItems: (int) Maximum number of items allowed in an array
- minLength: (int) Minimum length of a string
- maxLength: (int) Maximum length of a string
- minimum: (int) Minimum value of an integer
- maximum: (int) Maximum value of an integer
- data: (array) Any additional custom data to use when serializing, validating, etc
- format: (string) Format used to coax a value into the correct format when serializing or unserializing.
You may specify either an array of filters OR a format, but not both.
Supported values: date-time, date, time, timestamp, date-time-http
- $ref: (string) String referencing a service description model. The parameter is replaced by the
schema contained in the model.
Create a new Parameter using an associative array of data. The array can contain the following information:
- name: (string) Unique name of the parameter
- type: (string|array) Type of variable (string, number, integer, boolean, object, array, numeric, null, any). Types are using for validation and determining the structure of a parameter. You can use a union type by providing an array of simple types. If one of the union types matches the provided value, then the value is valid.
- instanceOf: (string) When the type is an object, you can specify the class that the object must implement
- required: (bool) Whether or not the parameter is required
- default: (mixed) Default value to use if no value is supplied
- static: (bool) Set to true to specify that the parameter value cannot be changed from the default
- description: (string) Documentation of the parameter
- location: (string) The location of a request used to apply a parameter. Custom locations can be registered with a command, but the defaults are uri, query, header, body, json, xml, postField, postFile.
- sentAs: (string) Specifies how the data being modeled is sent over the wire. For example, you may wish to include certain headers in a response model that have a normalized casing of FooBar, but the actual header is x-foo-bar. In this case, sentAs would be set to x-foo-bar.
- filters: (array) Array of static method names to to run a parameter value through. Each value in the array must be a string containing the full class path to a static method or an array of complex filter information. You can specify static methods of classes using the full namespace class name followed by '::' (e.g. Foo\Bar::baz()). Some filters require arguments in order to properly filter a value. For complex filters, use a hash containing a 'method' key pointing to a static method, and an 'args' key containing an array of positional arguments to pass to the method. Arguments can contain keywords that are replaced when filtering a value: '@value' is replaced with the value being validated, '@api' is replaced with the Parameter object.
- properties: When the type is an object, you can specify nested parameters
- additionalProperties: (array) This attribute defines a schema for all properties that are not explicitly defined in an object type definition. If specified, the value MUST be a schema or a boolean. If false is provided, no additional properties are allowed beyond the properties defined in the schema. The default value is an empty schema which allows any value for additional properties.
- items: This attribute defines the allowed items in an instance array, and MUST be a schema or an array of schemas. The default value is an empty schema which allows any value for items in the instance array. When this attribute value is a schema and the instance value is an array, then all the items in the array MUST be valid according to the schema.
- pattern: When the type is a string, you can specify the regex pattern that a value must match
- enum: When the type is a string, you can specify a list of acceptable values
- minItems: (int) Minimum number of items allowed in an array
- maxItems: (int) Maximum number of items allowed in an array
- minLength: (int) Minimum length of a string
- maxLength: (int) Maximum length of a string
- minimum: (int) Minimum value of an integer
- maximum: (int) Maximum value of an integer
- data: (array) Any additional custom data to use when serializing, validating, etc
- format: (string) Format used to coax a value into the correct format when serializing or unserializing. You may specify either an array of filters OR a format, but not both. Supported values: date-time, date, time, timestamp, date-time-http
- $ref: (string) String referencing a service description model. The parameter is replaced by the schema contained in the model.
Parameters
- $data
- Array of data as seen in service descriptions
- $description
- Service description used to resolve models if $ref tags are found
Throws
|
public
array
|
#
toArray( )
Convert the object to an array
Convert the object to an array
Returns
array
|
public
mixed
|
#
getValue( string $value )
Get the default or static value of the command based on a value
Get the default or static value of the command based on a value
Parameters
- $value
- Value that is currently set
Returns
mixed Returns the value, a static value if one is present, or a default value
|
public
mixed
|
#
filter( mixed $value )
Run a value through the filters OR format attribute associated with the parameter
Run a value through the filters OR format attribute associated with the parameter
Parameters
Returns
mixed Returns the filtered value
|
public
string
|
#
getName( )
Get the name of the parameter
Get the name of the parameter
Returns
string
|
public
string
|
#
getWireName( )
Get the key of the parameter, where sentAs will supersede name if it is set
Get the key of the parameter, where sentAs will supersede name if it is set
Returns
string
|
public
Guzzle\Service\Description\Parameter
|
#
setName( string $name )
Set the name of the parameter
Set the name of the parameter
Parameters
Returns
|
public
string|array
|
#
getType( )
Get the type(s) of the parameter
Get the type(s) of the parameter
Returns
string|array
|
public
Guzzle\Service\Description\Parameter
|
#
setType( string|array $type )
Set the type(s) of the parameter
Set the type(s) of the parameter
Parameters
- $type
- Type of parameter or array of simple types used in a union
Returns
|
public
boolean
|
#
getRequired( )
Get if the parameter is required
Get if the parameter is required
Returns
boolean
|
public
Guzzle\Service\Description\Parameter
|
#
setRequired( boolean $isRequired )
Set if the parameter is required
Set if the parameter is required
Parameters
- $isRequired
- Whether or not the parameter is required
Returns
|
public
string|null
|
#
getDefault( )
Get the default value of the parameter
Get the default value of the parameter
Returns
string|null
|
public
Guzzle\Service\Description\Parameter
|
#
setDefault( string|null $default )
Set the default value of the parameter
Set the default value of the parameter
Parameters
- $default
- Default value to set
Returns
|
public
string|null
|
#
getDescription( )
Get the description of the parameter
Get the description of the parameter
Returns
string|null
|
public
Guzzle\Service\Description\Parameter
|
#
setDescription( string $description )
Set the description of the parameter
Set the description of the parameter
Parameters
Returns
|
public
integer|null
|
#
getMinimum( )
Get the minimum acceptable value for an integer
Get the minimum acceptable value for an integer
Returns
integer|null
|
public
Guzzle\Service\Description\Parameter
|
#
setMinimum( integer|null $min )
Set the minimum acceptable value for an integer
Set the minimum acceptable value for an integer
Parameters
Returns
|
public
integer|null
|
#
getMaximum( )
Get the maximum acceptable value for an integer
Get the maximum acceptable value for an integer
Returns
integer|null
|
public
Guzzle\Service\Description\Parameter
|
#
setMaximum( integer $max )
Set the maximum acceptable value for an integer
Set the maximum acceptable value for an integer
Parameters
Returns
|
public
integer
|
#
getMinLength( )
Get the minimum allowed length of a string value
Get the minimum allowed length of a string value
Returns
integer
|
public
Guzzle\Service\Description\Parameter
|
#
setMinLength( integer|null $min )
Set the minimum allowed length of a string value
Set the minimum allowed length of a string value
Parameters
Returns
|
public
integer|null
|
#
getMaxLength( )
Get the maximum allowed length of a string value
Get the maximum allowed length of a string value
Returns
integer|null
|
public
Guzzle\Service\Description\Parameter
|
#
setMaxLength( integer $max )
Set the maximum allowed length of a string value
Set the maximum allowed length of a string value
Parameters
Returns
|
public
integer|null
|
#
getMaxItems( )
Get the maximum allowed number of items in an array value
Get the maximum allowed number of items in an array value
Returns
integer|null
|
public
Guzzle\Service\Description\Parameter
|
#
setMaxItems( integer $max )
Set the maximum allowed number of items in an array value
Set the maximum allowed number of items in an array value
Parameters
Returns
|
public
integer
|
#
getMinItems( )
Get the minimum allowed number of items in an array value
Get the minimum allowed number of items in an array value
Returns
integer
|
public
Guzzle\Service\Description\Parameter
|
#
setMinItems( integer|null $min )
Set the minimum allowed number of items in an array value
Set the minimum allowed number of items in an array value
Parameters
Returns
|
public
string|null
|
#
getLocation( )
Get the location of the parameter
Get the location of the parameter
Returns
string|null
|
public
Guzzle\Service\Description\Parameter
|
#
setLocation( string|null $location )
Set the location of the parameter
Set the location of the parameter
Parameters
- $location
- Location of the parameter
Returns
|
public
string|null
|
#
getSentAs( )
Get the sentAs attribute of the parameter that used with locations to sentAs an attribute when it is being
applied to a location.
Get the sentAs attribute of the parameter that used with locations to sentAs an attribute when it is being
applied to a location.
Returns
string|null
|
public
Guzzle\Service\Description\Parameter
|
#
setSentAs( string|null $name )
Set the sentAs attribute
Parameters
- $name
- Name of the value as it is sent over the wire
Returns
|
public
array|mixed|null
|
#
getData( string|null $name = null )
Retrieve a known property from the parameter by name or a data property by name. When not specific name value
is specified, all data properties will be returned.
Retrieve a known property from the parameter by name or a data property by name. When not specific name value
is specified, all data properties will be returned.
Parameters
- $name
- Specify a particular property name to retrieve
Returns
array|mixed|null
|
public
Guzzle\Service\Description\Parameter
|
#
setData( string|array|null $nameOrData, mixed|null $data = null )
Set the extra data properties of the parameter or set a specific extra property
Set the extra data properties of the parameter or set a specific extra property
Parameters
- $nameOrData
- The name of a specific extra to set or an array of extras to set
- $data
- When setting a specific extra property, specify the data to set for it
Returns
|
public
mixed|null
|
#
getStatic( )
Get whether or not the default value can be changed
Get whether or not the default value can be changed
Returns
mixed|null
|
public
Guzzle\Service\Description\Parameter
|
#
setStatic( boolean $static )
Set to true if the default value cannot be changed
Set to true if the default value cannot be changed
Parameters
Returns
|
public
array
|
#
getFilters( )
Get an array of filters used by the parameter
Get an array of filters used by the parameter
Returns
array
|
public
Guzzle\Service\Description\Parameter
|
#
setFilters( array $filters )
Set the array of filters used by the parameter
Set the array of filters used by the parameter
Parameters
- $filters
- Array of functions to use as filters
Returns
|
public
Guzzle\Service\Description\Parameter
|
#
addFilter( string|array $filter )
Add a filter to the parameter
Add a filter to the parameter
Parameters
- $filter
- Method to filter the value through
Returns
Throws
|
public
Guzzle\Service\Description\OperationInterface |Guzzle\Service\Description\Parameter |null
|
|
public
Guzzle\Service\Description\Parameter
|
|
public
array
|
#
getProperties( )
Get the properties of the parameter
Get the properties of the parameter
Returns
array
|
public
null|Guzzle\Service\Description\Parameter
|
#
getProperty( string $name )
Get a specific property from the parameter
Get a specific property from the parameter
Parameters
- $name
- Name of the property to retrieve
Returns
|
public
Guzzle\Service\Description\Parameter
|
#
removeProperty( string $name )
Remove a property from the parameter
Remove a property from the parameter
Parameters
- $name
- Name of the property to remove
Returns
|
public
Guzzle\Service\Description\Parameter
|
|
public
boolean|Guzzle\Service\Description\Parameter |null
|
#
getAdditionalProperties( )
Get the additionalProperties value of the parameter
Get the additionalProperties value of the parameter
Returns
|
public
Guzzle\Service\Description\Parameter
|
#
setAdditionalProperties( boolean|Guzzle\Service\Description\Parameter |null $additional )
Set the additionalProperties value of the parameter
Set the additionalProperties value of the parameter
Parameters
- $additional
- Boolean to allow any, an Parameter to specify a schema, or false to disallow
Returns
|
public
Guzzle\Service\Description\Parameter
|
|
public
Guzzle\Service\Description\Parameter |null
|
#
getItems( )
Get the item data of the parameter
Get the item data of the parameter
Returns
|
public
null|string
|
#
getInstanceOf( )
Get the class that the parameter must implement
Get the class that the parameter must implement
Returns
null|string
|
public
Guzzle\Service\Description\Parameter
|
#
setInstanceOf( string|null $instanceOf )
Set the class that the parameter must be an instance of
Set the class that the parameter must be an instance of
Parameters
- $instanceOf
- Class or interface name
Returns
|
public
array|null
|
#
getEnum( )
Get the enum of strings that are valid for the parameter
Get the enum of strings that are valid for the parameter
Returns
array|null
|
public
Guzzle\Service\Description\Parameter
|
#
setEnum( array $enum = null )
Set the enum of strings that are valid for the parameter
Set the enum of strings that are valid for the parameter
Parameters
- $enum
- Array of strings or null
Returns
|
public
string
|
#
getPattern( )
Get the regex pattern that must match a value when the value is a string
Get the regex pattern that must match a value when the value is a string
Returns
string
|
public
Guzzle\Service\Description\Parameter
|
#
setPattern( string $pattern )
Set the regex pattern that must match a value when the value is a string
Set the regex pattern that must match a value when the value is a string
Parameters
Returns
|
public
string
|
#
getFormat( )
Get the format attribute of the schema
Get the format attribute of the schema
Returns
string
|
public
Guzzle\Service\Description\Parameter
|
#
setFormat( string $format )
Set the format attribute of the schema
Set the format attribute of the schema
Parameters
- $format
- Format to set (e.g. date, date-time, timestamp, time, date-time-http)
Returns
|