Open Journal Systems  3.3.0
Guzzle\Service\Description\Parameter Class Reference

Public Member Functions

 __construct (array $data=array(), ServiceDescriptionInterface $description=null)
 
 addFilter ($filter)
 
 addProperty (Parameter $property)
 
 filter ($value)
 
 getAdditionalProperties ()
 
 getData ($name=null)
 
 getDefault ()
 
 getDescription ()
 
 getEnum ()
 
 getFilters ()
 
 getFormat ()
 
 getInstanceOf ()
 
 getItems ()
 
 getLocation ()
 
 getMaximum ()
 
 getMaxItems ()
 
 getMaxLength ()
 
 getMinimum ()
 
 getMinItems ()
 
 getMinLength ()
 
 getName ()
 
 getParent ()
 
 getPattern ()
 
 getProperties ()
 
 getProperty ($name)
 
 getRequired ()
 
 getSentAs ()
 
 getStatic ()
 
 getType ()
 
 getValue ($value)
 
 getWireName ()
 
 removeProperty ($name)
 
 setAdditionalProperties ($additional)
 
 setData ($nameOrData, $data=null)
 
 setDefault ($default)
 
 setDescription ($description)
 
 setEnum (array $enum=null)
 
 setFilters (array $filters)
 
 setFormat ($format)
 
 setInstanceOf ($instanceOf)
 
 setItems (Parameter $items=null)
 
 setLocation ($location)
 
 setMaximum ($max)
 
 setMaxItems ($max)
 
 setMaxLength ($max)
 
 setMinimum ($min)
 
 setMinItems ($min)
 
 setMinLength ($min)
 
 setName ($name)
 
 setParent ($parent)
 
 setPattern ($pattern)
 
 setRequired ($isRequired)
 
 setSentAs ($name)
 
 setStatic ($static)
 
 setType ($type)
 
 toArray ()
 

Protected Attributes

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

Detailed Description

API parameter object used with service descriptions

Definition at line 10 of file Parameter.php.

Constructor & Destructor Documentation

◆ __construct()

Guzzle\Service\Description\Parameter::__construct ( array  $data = array(),
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.
Parameters
array$dataArray of data as seen in service descriptions
ServiceDescriptionInterface$descriptionService description used to resolve models if $ref tags are found
Exceptions
InvalidArgumentException

Definition at line 95 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$data, Guzzle\Service\Description\Parameter\$description, and Guzzle\Service\Description\Parameter\setFilters().

Member Function Documentation

◆ addFilter()

Guzzle\Service\Description\Parameter::addFilter (   $filter)

Add a filter to the parameter

Parameters
string | array$filterMethod to filter the value through
Returns
self
Exceptions
InvalidArgumentException

Definition at line 659 of file Parameter.php.

Referenced by Guzzle\Service\Description\Parameter\setFilters().

◆ addProperty()

Guzzle\Service\Description\Parameter::addProperty ( Parameter  $property)

Add a property to the parameter

Parameters
Parameter$propertyProperties to set
Returns
self

Definition at line 761 of file Parameter.php.

References Guzzle\Service\Description\Parameter\getName(), and Guzzle\Service\Description\Parameter\setParent().

◆ filter()

◆ getAdditionalProperties()

◆ getData()

Guzzle\Service\Description\Parameter::getData (   $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.

Parameters
string | null$nameSpecify a particular property name to retrieve
Returns
array|mixed|null

Definition at line 566 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$data, and Guzzle\Service\Description\Parameter\$name.

Referenced by Guzzle\Service\Command\LocationVisitor\Request\XmlVisitor\addXml(), and Guzzle\Service\Command\LocationVisitor\Request\BodyVisitor\visit().

◆ getDefault()

Guzzle\Service\Description\Parameter::getDefault ( )

Get the default value of the parameter

Returns
string|null

Definition at line 322 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$default.

◆ getDescription()

Guzzle\Service\Description\Parameter::getDescription ( )

Get the description of the parameter

Returns
string|null

Definition at line 346 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$description.

Referenced by Guzzle\Service\Description\SchemaValidator\recursiveProcess().

◆ getEnum()

Guzzle\Service\Description\Parameter::getEnum ( )

Get the enum of strings that are valid for the parameter

Returns
array|null

Definition at line 859 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$enum.

Referenced by Guzzle\Service\Description\SchemaValidator\recursiveProcess().

◆ getFilters()

Guzzle\Service\Description\Parameter::getFilters ( )

Get an array of filters used by the parameter

Returns
array

Definition at line 629 of file Parameter.php.

◆ getFormat()

Guzzle\Service\Description\Parameter::getFormat ( )

Get the format attribute of the schema

Returns
string

Definition at line 907 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$format.

◆ getInstanceOf()

Guzzle\Service\Description\Parameter::getInstanceOf ( )

Get the class that the parameter must implement

Returns
null|string

Definition at line 835 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$instanceOf.

Referenced by Guzzle\Service\Description\SchemaValidator\recursiveProcess().

◆ getItems()

◆ getLocation()

Guzzle\Service\Description\Parameter::getLocation ( )

◆ getMaximum()

Guzzle\Service\Description\Parameter::getMaximum ( )

Get the maximum acceptable value for an integer

Returns
int|null

Definition at line 394 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$maximum.

Referenced by Guzzle\Service\Description\SchemaValidator\recursiveProcess().

◆ getMaxItems()

Guzzle\Service\Description\Parameter::getMaxItems ( )

Get the maximum allowed number of items in an array value

Returns
int|null

Definition at line 466 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$maxItems.

Referenced by Guzzle\Service\Description\SchemaValidator\recursiveProcess().

◆ getMaxLength()

Guzzle\Service\Description\Parameter::getMaxLength ( )

Get the maximum allowed length of a string value

Returns
int|null

Definition at line 442 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$maxLength.

Referenced by Guzzle\Service\Description\SchemaValidator\recursiveProcess().

◆ getMinimum()

Guzzle\Service\Description\Parameter::getMinimum ( )

Get the minimum acceptable value for an integer

Returns
int|null

Definition at line 370 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$minimum.

Referenced by Guzzle\Service\Description\SchemaValidator\recursiveProcess().

◆ getMinItems()

Guzzle\Service\Description\Parameter::getMinItems ( )

Get the minimum allowed number of items in an array value

Returns
int

Definition at line 490 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$minItems.

Referenced by Guzzle\Service\Description\SchemaValidator\recursiveProcess().

◆ getMinLength()

Guzzle\Service\Description\Parameter::getMinLength ( )

Get the minimum allowed length of a string value

Returns
int

Definition at line 418 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$minLength.

Referenced by Guzzle\Service\Description\SchemaValidator\recursiveProcess().

◆ getName()

◆ getParent()

Guzzle\Service\Description\Parameter::getParent ( )

Get the parent object (an {

See also
OperationInterface} or {
Parameter}
Returns
OperationInterface|Parameter|null

Definition at line 681 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$parent.

Referenced by Guzzle\Service\Command\LocationVisitor\Request\XmlVisitor\visit().

◆ getPattern()

Guzzle\Service\Description\Parameter::getPattern ( )

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

Returns
string

Definition at line 883 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$pattern.

Referenced by Guzzle\Service\Description\SchemaValidator\recursiveProcess().

◆ getProperties()

◆ getProperty()

◆ getRequired()

Guzzle\Service\Description\Parameter::getRequired ( )

Get if the parameter is required

Returns
bool

Definition at line 298 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$required.

Referenced by Guzzle\Service\Description\SchemaValidator\recursiveProcess().

◆ getSentAs()

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.

Returns
string|null

Definition at line 539 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$sentAs.

Referenced by Guzzle\Service\Command\LocationVisitor\Request\HeaderVisitor\addPrefixedHeaders(), and Guzzle\Service\Command\LocationVisitor\Response\HeaderVisitor\processPrefixedHeaders().

◆ getStatic()

Guzzle\Service\Description\Parameter::getStatic ( )

Get whether or not the default value can be changed

Returns
mixed|null

Definition at line 605 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$static.

Referenced by Guzzle\Service\Description\SchemaValidator\recursiveProcess().

◆ getType()

◆ getValue()

Guzzle\Service\Description\Parameter::getValue (   $value)

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

Parameters
string$valueValue that is currently set
Returns
mixed Returns the value, a static value if one is present, or a default value

Definition at line 185 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$default.

Referenced by Guzzle\Service\Description\SchemaValidator\recursiveProcess().

◆ getWireName()

◆ removeProperty()

Guzzle\Service\Description\Parameter::removeProperty (   $name)

Remove a property from the parameter

Parameters
string$nameName of the property to remove
Returns
self

Definition at line 746 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$name.

◆ setAdditionalProperties()

Guzzle\Service\Description\Parameter::setAdditionalProperties (   $additional)

Set the additionalProperties value of the parameter

Parameters
bool | Parameter | null$additionalBoolean to allow any, an Parameter to specify a schema, or false to disallow
Returns
self

Definition at line 792 of file Parameter.php.

◆ setData()

Guzzle\Service\Description\Parameter::setData (   $nameOrData,
  $data = null 
)

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

Parameters
string | array | null$nameOrDataThe name of a specific extra to set or an array of extras to set
mixed | null$dataWhen setting a specific extra property, specify the data to set for it
Returns
self

Definition at line 589 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$data.

◆ setDefault()

Guzzle\Service\Description\Parameter::setDefault (   $default)

Set the default value of the parameter

Parameters
string | null$defaultDefault value to set
Returns
self

Definition at line 334 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$default.

◆ setDescription()

Guzzle\Service\Description\Parameter::setDescription (   $description)

Set the description of the parameter

Parameters
string$descriptionDescription
Returns
self

Definition at line 358 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$description.

◆ setEnum()

Guzzle\Service\Description\Parameter::setEnum ( array  $enum = null)

Set the enum of strings that are valid for the parameter

Parameters
array | null$enumArray of strings or null
Returns
self

Definition at line 871 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$enum.

◆ setFilters()

Guzzle\Service\Description\Parameter::setFilters ( array  $filters)

Set the array of filters used by the parameter

Parameters
array$filtersArray of functions to use as filters
Returns
self

Definition at line 641 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$filters, and Guzzle\Service\Description\Parameter\addFilter().

Referenced by Guzzle\Service\Description\Parameter\__construct().

◆ setFormat()

Guzzle\Service\Description\Parameter::setFormat (   $format)

Set the format attribute of the schema

Parameters
string$formatFormat to set (e.g. date, date-time, timestamp, time, date-time-http)
Returns
self

Definition at line 919 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$format.

◆ setInstanceOf()

Guzzle\Service\Description\Parameter::setInstanceOf (   $instanceOf)

Set the class that the parameter must be an instance of

Parameters
string | null$instanceOfClass or interface name
Returns
self

Definition at line 847 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$instanceOf.

◆ setItems()

Guzzle\Service\Description\Parameter::setItems ( Parameter  $items = null)

Set the items data of the parameter

Parameters
Parameter | null$itemsItems to set
Returns
self

Definition at line 806 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$items.

◆ setLocation()

Guzzle\Service\Description\Parameter::setLocation (   $location)

Set the location of the parameter

Parameters
string | null$locationLocation of the parameter
Returns
self

Definition at line 526 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$location.

◆ setMaximum()

Guzzle\Service\Description\Parameter::setMaximum (   $max)

Set the maximum acceptable value for an integer

Parameters
int$maxMaximum
Returns
self

Definition at line 406 of file Parameter.php.

◆ setMaxItems()

Guzzle\Service\Description\Parameter::setMaxItems (   $max)

Set the maximum allowed number of items in an array value

Parameters
int$maxMaximum
Returns
self

Definition at line 478 of file Parameter.php.

◆ setMaxLength()

Guzzle\Service\Description\Parameter::setMaxLength (   $max)

Set the maximum allowed length of a string value

Parameters
int$maxMaximum length
Returns
self

Definition at line 454 of file Parameter.php.

◆ setMinimum()

Guzzle\Service\Description\Parameter::setMinimum (   $min)

Set the minimum acceptable value for an integer

Parameters
int | null$minMinimum
Returns
self

Definition at line 382 of file Parameter.php.

◆ setMinItems()

Guzzle\Service\Description\Parameter::setMinItems (   $min)

Set the minimum allowed number of items in an array value

Parameters
int | null$minMinimum
Returns
self

Definition at line 502 of file Parameter.php.

◆ setMinLength()

Guzzle\Service\Description\Parameter::setMinLength (   $min)

Set the minimum allowed length of a string value

Parameters
int | null$minMinimum
Returns
self

Definition at line 430 of file Parameter.php.

◆ setName()

Guzzle\Service\Description\Parameter::setName (   $name)

Set the name of the parameter

Parameters
string$nameName to set
Returns
self

Definition at line 262 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$name.

Referenced by Guzzle\Service\Command\DefaultRequestSerializer\prepareAdditionalParameters(), and Guzzle\Service\Command\OperationResponseParser\visitAdditionalProperties().

◆ setParent()

Guzzle\Service\Description\Parameter::setParent (   $parent)

Set the parent object of the parameter

Parameters
OperationInterface | Parameter | null$parentParent container of the parameter
Returns
self

Definition at line 693 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$parent.

Referenced by Guzzle\Service\Description\Operation\addParam(), and Guzzle\Service\Description\Parameter\addProperty().

◆ setPattern()

Guzzle\Service\Description\Parameter::setPattern (   $pattern)

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

Parameters
string$patternRegex pattern
Returns
self

Definition at line 895 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$pattern.

◆ setRequired()

Guzzle\Service\Description\Parameter::setRequired (   $isRequired)

Set if the parameter is required

Parameters
bool$isRequiredWhether or not the parameter is required
Returns
self

Definition at line 310 of file Parameter.php.

◆ setSentAs()

Guzzle\Service\Description\Parameter::setSentAs (   $name)

Set the sentAs attribute

Parameters
string | null$nameName of the value as it is sent over the wire
Returns
self

Definition at line 551 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$name.

◆ setStatic()

Guzzle\Service\Description\Parameter::setStatic (   $static)

Set to true if the default value cannot be changed

Parameters
bool$staticTrue or false
Returns
self

Definition at line 617 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$static.

◆ setType()

Guzzle\Service\Description\Parameter::setType (   $type)

Set the type(s) of the parameter

Parameters
string | array$typeType of parameter or array of simple types used in a union
Returns
self

Definition at line 286 of file Parameter.php.

References Guzzle\Service\Description\Parameter\$type.

◆ toArray()

Field Documentation

◆ $additionalProperties

Guzzle\Service\Description\Parameter::$additionalProperties
protected

◆ $data

◆ $default

◆ $description

Guzzle\Service\Description\Parameter::$description
protected

◆ $enum

Guzzle\Service\Description\Parameter::$enum
protected

◆ $filters

Guzzle\Service\Description\Parameter::$filters
protected

Definition at line 28 of file Parameter.php.

Referenced by Guzzle\Service\Description\Parameter\setFilters().

◆ $format

Guzzle\Service\Description\Parameter::$format
protected

◆ $instanceOf

Guzzle\Service\Description\Parameter::$instanceOf
protected

◆ $items

Guzzle\Service\Description\Parameter::$items
protected

◆ $location

Guzzle\Service\Description\Parameter::$location
protected

◆ $maximum

Guzzle\Service\Description\Parameter::$maximum
protected

Definition at line 20 of file Parameter.php.

Referenced by Guzzle\Service\Description\Parameter\getMaximum().

◆ $maxItems

Guzzle\Service\Description\Parameter::$maxItems
protected

Definition at line 24 of file Parameter.php.

Referenced by Guzzle\Service\Description\Parameter\getMaxItems().

◆ $maxLength

Guzzle\Service\Description\Parameter::$maxLength
protected

Definition at line 22 of file Parameter.php.

Referenced by Guzzle\Service\Description\Parameter\getMaxLength().

◆ $minimum

Guzzle\Service\Description\Parameter::$minimum
protected

Definition at line 19 of file Parameter.php.

Referenced by Guzzle\Service\Description\Parameter\getMinimum().

◆ $minItems

Guzzle\Service\Description\Parameter::$minItems
protected

Definition at line 23 of file Parameter.php.

Referenced by Guzzle\Service\Description\Parameter\getMinItems().

◆ $minLength

Guzzle\Service\Description\Parameter::$minLength
protected

Definition at line 21 of file Parameter.php.

Referenced by Guzzle\Service\Description\Parameter\getMinLength().

◆ $name

◆ $parent

Guzzle\Service\Description\Parameter::$parent
protected

◆ $pattern

Guzzle\Service\Description\Parameter::$pattern
protected

◆ $properties

Guzzle\Service\Description\Parameter::$properties = array()
protected

Definition at line 32 of file Parameter.php.

◆ $propertiesCache

Guzzle\Service\Description\Parameter::$propertiesCache = null
protected

Definition at line 38 of file Parameter.php.

Referenced by Guzzle\Service\Description\Parameter\getProperties().

◆ $ref

Guzzle\Service\Description\Parameter::$ref
protected

Definition at line 36 of file Parameter.php.

◆ $required

Guzzle\Service\Description\Parameter::$required
protected

Definition at line 16 of file Parameter.php.

Referenced by Guzzle\Service\Description\Parameter\getRequired().

◆ $sentAs

Guzzle\Service\Description\Parameter::$sentAs
protected

Definition at line 30 of file Parameter.php.

Referenced by Guzzle\Service\Description\Parameter\getSentAs().

◆ $serviceDescription

Guzzle\Service\Description\Parameter::$serviceDescription
protected

◆ $static

Guzzle\Service\Description\Parameter::$static
protected

◆ $type

Guzzle\Service\Description\Parameter::$type
protected

The documentation for this class was generated from the following file: