Class Guzzle\Service\Description\Parameter

InheritanceGuzzle\Service\Description\Parameter

API parameter object used with service descriptions

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() 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. Guzzle\Service\Description\Parameter
addFilter() Add a filter to the parameter Guzzle\Service\Description\Parameter
addProperty() Add a property to the parameter Guzzle\Service\Description\Parameter
filter() Run a value through the filters OR format attribute associated with the parameter Guzzle\Service\Description\Parameter
getAdditionalProperties() Get the additionalProperties value of the parameter Guzzle\Service\Description\Parameter
getData() 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. Guzzle\Service\Description\Parameter
getDefault() Get the default value of the parameter Guzzle\Service\Description\Parameter
getDescription() Get the description of the parameter Guzzle\Service\Description\Parameter
getEnum() Get the enum of strings that are valid for the parameter Guzzle\Service\Description\Parameter
getFilters() Get an array of filters used by the parameter Guzzle\Service\Description\Parameter
getFormat() Get the format attribute of the schema Guzzle\Service\Description\Parameter
getInstanceOf() Get the class that the parameter must implement Guzzle\Service\Description\Parameter
getItems() Get the item data of the parameter Guzzle\Service\Description\Parameter
getLocation() Get the location of the parameter Guzzle\Service\Description\Parameter
getMaxItems() Get the maximum allowed number of items in an array value Guzzle\Service\Description\Parameter
getMaxLength() Get the maximum allowed length of a string value Guzzle\Service\Description\Parameter
getMaximum() Get the maximum acceptable value for an integer Guzzle\Service\Description\Parameter
getMinItems() Get the minimum allowed number of items in an array value Guzzle\Service\Description\Parameter
getMinLength() Get the minimum allowed length of a string value Guzzle\Service\Description\Parameter
getMinimum() Get the minimum acceptable value for an integer Guzzle\Service\Description\Parameter
getName() Get the name of the parameter Guzzle\Service\Description\Parameter
getParent() Get the parent object (an {@see OperationInterface} or {@see Parameter} Guzzle\Service\Description\Parameter
getPattern() Get the regex pattern that must match a value when the value is a string Guzzle\Service\Description\Parameter
getProperties() Get the properties of the parameter Guzzle\Service\Description\Parameter
getProperty() Get a specific property from the parameter Guzzle\Service\Description\Parameter
getRequired() Get if the parameter is required Guzzle\Service\Description\Parameter
getSentAs() Get the sentAs attribute of the parameter that used with locations to sentAs an attribute when it is being applied to a location. Guzzle\Service\Description\Parameter
getStatic() Get whether or not the default value can be changed Guzzle\Service\Description\Parameter
getType() Get the type(s) of the parameter Guzzle\Service\Description\Parameter
getValue() Get the default or static value of the command based on a value Guzzle\Service\Description\Parameter
getWireName() Get the key of the parameter, where sentAs will supersede name if it is set Guzzle\Service\Description\Parameter
removeProperty() Remove a property from the parameter Guzzle\Service\Description\Parameter
setAdditionalProperties() Set the additionalProperties value of the parameter Guzzle\Service\Description\Parameter
setData() Set the extra data properties of the parameter or set a specific extra property Guzzle\Service\Description\Parameter
setDefault() Set the default value of the parameter Guzzle\Service\Description\Parameter
setDescription() Set the description of the parameter Guzzle\Service\Description\Parameter
setEnum() Set the enum of strings that are valid for the parameter Guzzle\Service\Description\Parameter
setFilters() Set the array of filters used by the parameter Guzzle\Service\Description\Parameter
setFormat() Set the format attribute of the schema Guzzle\Service\Description\Parameter
setInstanceOf() Set the class that the parameter must be an instance of Guzzle\Service\Description\Parameter
setItems() Set the items data of the parameter Guzzle\Service\Description\Parameter
setLocation() Set the location of the parameter Guzzle\Service\Description\Parameter
setMaxItems() Set the maximum allowed number of items in an array value Guzzle\Service\Description\Parameter
setMaxLength() Set the maximum allowed length of a string value Guzzle\Service\Description\Parameter
setMaximum() Set the maximum acceptable value for an integer Guzzle\Service\Description\Parameter
setMinItems() Set the minimum allowed number of items in an array value Guzzle\Service\Description\Parameter
setMinLength() Set the minimum allowed length of a string value Guzzle\Service\Description\Parameter
setMinimum() Set the minimum acceptable value for an integer Guzzle\Service\Description\Parameter
setName() Set the name of the parameter Guzzle\Service\Description\Parameter
setParent() Set the parent object of the parameter Guzzle\Service\Description\Parameter
setPattern() Set the regex pattern that must match a value when the value is a string Guzzle\Service\Description\Parameter
setRequired() Set if the parameter is required Guzzle\Service\Description\Parameter
setSentAs() Set the sentAs attribute Guzzle\Service\Description\Parameter
setStatic() Set to true if the default value cannot be changed Guzzle\Service\Description\Parameter
setType() Set the type(s) of the parameter Guzzle\Service\Description\Parameter
toArray() Convert the object to an array Guzzle\Service\Description\Parameter

Property Details

$additionalProperties protected property
protected $additionalProperties null
$data protected property
protected $data null
$default protected property
protected $default null
$description protected property
protected $description null
$enum protected property
protected $enum null
$filters protected property
protected $filters null
$format protected property
protected $format null
$instanceOf protected property
protected $instanceOf null
$items protected property
protected $items null
$location protected property
protected $location null
$maxItems protected property
protected $maxItems null
$maxLength protected property
protected $maxLength null
$maximum protected property
protected $maximum null
$minItems protected property
protected $minItems null
$minLength protected property
protected $minLength null
$minimum protected property
protected $minimum null
$name protected property
protected $name null
$parent protected property
protected $parent null
$pattern protected property
protected $pattern null
$properties protected property
protected $properties = []
$propertiesCache protected property
protected $propertiesCache null
$ref protected property
protected $ref null
$required protected property
protected $required null
$sentAs protected property
protected $sentAs null
$serviceDescription protected property
protected $serviceDescription null
$static protected property
protected $static null
$type protected property
protected $type null

Method Details

__construct() public method

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.
    
public void __construct ( array $data = [], Guzzle\Service\Description\ServiceDescriptionInterface $description null )
$data array

Array of data as seen in service descriptions

$description Guzzle\Service\Description\ServiceDescriptionInterface

Service description used to resolve models if $ref tags are found

throws Guzzle\Common\Exception\InvalidArgumentException
addFilter() public method

Add a filter to the parameter

public self addFilter ( $filter )
$filter string|array

Method to filter the value through

throws Guzzle\Common\Exception\InvalidArgumentException
addProperty() public method

Add a property to the parameter

public self addProperty ( Guzzle\Service\Description\Parameter $property )
$property Guzzle\Service\Description\Parameter

Properties to set

filter() public method

Run a value through the filters OR format attribute associated with the parameter

public mixed filter ( $value )
$value mixed

Value to filter

return mixed

Returns the filtered value

getAdditionalProperties() public method

Get the additionalProperties value of the parameter

public bool|Guzzle\Service\Description\Parameter|null getAdditionalProperties ( )
getData() public method

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.

public array|mixed|null getData ( $name null )
$name string|null

Specify a particular property name to retrieve

getDefault() public method

Get the default value of the parameter

public string|null getDefault ( )
getDescription() public method

Get the description of the parameter

public string|null getDescription ( )
getEnum() public method

Get the enum of strings that are valid for the parameter

public array|null getEnum ( )
getFilters() public method

Get an array of filters used by the parameter

public array getFilters ( )
getFormat() public method

Get the format attribute of the schema

public string getFormat ( )
getInstanceOf() public method

Get the class that the parameter must implement

public null|string getInstanceOf ( )
getItems() public method

Get the item data of the parameter

public Guzzle\Service\Description\Parameter|null getItems ( )
getLocation() public method

Get the location of the parameter

public string|null getLocation ( )
getMaxItems() public method

Get the maximum allowed number of items in an array value

public int|null getMaxItems ( )
getMaxLength() public method

Get the maximum allowed length of a string value

public int|null getMaxLength ( )
getMaximum() public method

Get the maximum acceptable value for an integer

public int|null getMaximum ( )
getMinItems() public method

Get the minimum allowed number of items in an array value

public int getMinItems ( )
getMinLength() public method

Get the minimum allowed length of a string value

public int getMinLength ( )
getMinimum() public method

Get the minimum acceptable value for an integer

public int|null getMinimum ( )
getName() public method

Get the name of the parameter

public string getName ( )
getParent() public method

Get the parent object (an {@see OperationInterface} or {@see Parameter}

public Guzzle\Service\Description\OperationInterface|Guzzle\Service\Description\Parameter|null getParent ( )
getPattern() public method

Get the regex pattern that must match a value when the value is a string

public string getPattern ( )
getProperties() public method

Get the properties of the parameter

public array getProperties ( )
getProperty() public method

Get a specific property from the parameter

public null|Guzzle\Service\Description\Parameter getProperty ( $name )
$name string

Name of the property to retrieve

getRequired() public method

Get if the parameter is required

public bool getRequired ( )
getSentAs() public method

Get the sentAs attribute of the parameter that used with locations to sentAs an attribute when it is being applied to a location.

public string|null getSentAs ( )
getStatic() public method

Get whether or not the default value can be changed

public mixed|null getStatic ( )
getType() public method

Get the type(s) of the parameter

public string|array getType ( )
getValue() public method

Get the default or static value of the command based on a value

public mixed getValue ( $value )
$value string

Value that is currently set

return mixed

Returns the value, a static value if one is present, or a default value

getWireName() public method

Get the key of the parameter, where sentAs will supersede name if it is set

public string getWireName ( )
removeProperty() public method

Remove a property from the parameter

public self removeProperty ( $name )
$name string

Name of the property to remove

setAdditionalProperties() public method

Set the additionalProperties value of the parameter

public self setAdditionalProperties ( $additional )
$additional bool|Guzzle\Service\Description\Parameter|null

Boolean to allow any, an Parameter to specify a schema, or false to disallow

setData() public method

Set the extra data properties of the parameter or set a specific extra property

public self setData ( $nameOrData, $data null )
$nameOrData string|array|null

The name of a specific extra to set or an array of extras to set

$data mixed|null

When setting a specific extra property, specify the data to set for it

setDefault() public method

Set the default value of the parameter

public self setDefault ( $default )
$default string|null

Default value to set

setDescription() public method

Set the description of the parameter

public self setDescription ( $description )
$description string

Description

setEnum() public method

Set the enum of strings that are valid for the parameter

public self setEnum ( array $enum null )
$enum array|null

Array of strings or null

setFilters() public method

Set the array of filters used by the parameter

public self setFilters ( array $filters )
$filters array

Array of functions to use as filters

setFormat() public method

Set the format attribute of the schema

public self setFormat ( $format )
$format string

Format to set (e.g. date, date-time, timestamp, time, date-time-http)

setInstanceOf() public method

Set the class that the parameter must be an instance of

public self setInstanceOf ( $instanceOf )
$instanceOf string|null

Class or interface name

setItems() public method

Set the items data of the parameter

public self setItems ( Guzzle\Service\Description\Parameter $items null )
$items Guzzle\Service\Description\Parameter|null

Items to set

setLocation() public method

Set the location of the parameter

public self setLocation ( $location )
$location string|null

Location of the parameter

setMaxItems() public method

Set the maximum allowed number of items in an array value

public self setMaxItems ( $max )
$max int

Maximum

setMaxLength() public method

Set the maximum allowed length of a string value

public self setMaxLength ( $max )
$max int

Maximum length

setMaximum() public method

Set the maximum acceptable value for an integer

public self setMaximum ( $max )
$max int

Maximum

setMinItems() public method

Set the minimum allowed number of items in an array value

public self setMinItems ( $min )
$min int|null

Minimum

setMinLength() public method

Set the minimum allowed length of a string value

public self setMinLength ( $min )
$min int|null

Minimum

setMinimum() public method

Set the minimum acceptable value for an integer

public self setMinimum ( $min )
$min int|null

Minimum

setName() public method

Set the name of the parameter

public self setName ( $name )
$name string

Name to set

setParent() public method

Set the parent object of the parameter

public self setParent ( $parent )
$parent Guzzle\Service\Description\OperationInterface|Guzzle\Service\Description\Parameter|null

Parent container of the parameter

setPattern() public method

Set the regex pattern that must match a value when the value is a string

public self setPattern ( $pattern )
$pattern string

Regex pattern

setRequired() public method

Set if the parameter is required

public self setRequired ( $isRequired )
$isRequired bool

Whether or not the parameter is required

setSentAs() public method

Set the sentAs attribute

public self setSentAs ( $name )
$name string|null

Name of the value as it is sent over the wire

setStatic() public method

Set to true if the default value cannot be changed

public self setStatic ( $static )
$static bool

True or false

setType() public method

Set the type(s) of the parameter

public self setType ( $type )
$type string|array

Type of parameter or array of simple types used in a union

toArray() public method

Convert the object to an array

public array toArray ( )