Parameter
in package
API parameter object used with service descriptions
Table of Contents
Properties
- $additionalProperties : mixed
- $data : mixed
- $default : mixed
- $description : mixed
- $enum : mixed
- $filters : mixed
- $format : mixed
- $instanceOf : mixed
- $items : mixed
- $location : mixed
- $maximum : mixed
- $maxItems : mixed
- $maxLength : mixed
- $minimum : mixed
- $minItems : mixed
- $minLength : mixed
- $name : mixed
- $parent : mixed
- $pattern : mixed
- $properties : mixed
- $propertiesCache : mixed
- $ref : mixed
- $required : mixed
- $sentAs : mixed
- $serviceDescription : mixed
- $static : mixed
- $type : mixed
Methods
- __construct() : mixed
- 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.
- addFilter() : self
- Add a filter to the parameter
- addProperty() : self
- Add a property to the parameter
- filter() : mixed
- Run a value through the filters OR format attribute associated with the parameter
- getAdditionalProperties() : bool|Parameter|null
- Get the additionalProperties value of the parameter
- getData() : array<string|int, mixed>|mixed|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.
- getDefault() : string|null
- Get the default value of the parameter
- getDescription() : string|null
- Get the description of the parameter
- getEnum() : array<string|int, mixed>|null
- Get the enum of strings that are valid for the parameter
- getFilters() : array<string|int, mixed>
- Get an array of filters used by the parameter
- getFormat() : string
- Get the format attribute of the schema
- getInstanceOf() : null|string
- Get the class that the parameter must implement
- getItems() : Parameter|null
- Get the item data of the parameter
- getLocation() : string|null
- Get the location of the parameter
- getMaximum() : int|null
- Get the maximum acceptable value for an integer
- getMaxItems() : int|null
- Get the maximum allowed number of items in an array value
- getMaxLength() : int|null
- Get the maximum allowed length of a string value
- getMinimum() : int|null
- Get the minimum acceptable value for an integer
- getMinItems() : int
- Get the minimum allowed number of items in an array value
- getMinLength() : int
- Get the minimum allowed length of a string value
- getName() : string
- Get the name of the parameter
- getParent() : OperationInterface|Parameter|null
- Get the parent object (an {@see OperationInterface} or {@see Parameter}
- getPattern() : string
- Get the regex pattern that must match a value when the value is a string
- getProperties() : array<string|int, mixed>
- Get the properties of the parameter
- getProperty() : null|Parameter
- Get a specific property from the parameter
- getRequired() : bool
- Get if the parameter is required
- getSentAs() : string|null
- Get the sentAs attribute of the parameter that used with locations to sentAs an attribute when it is being applied to a location.
- getStatic() : mixed|null
- Get whether or not the default value can be changed
- getType() : string|array<string|int, mixed>
- Get the type(s) of the parameter
- getValue() : mixed
- Get the default or static value of the command based on a value
- getWireName() : string
- Get the key of the parameter, where sentAs will supersede name if it is set
- removeProperty() : self
- Remove a property from the parameter
- setAdditionalProperties() : self
- Set the additionalProperties value of the parameter
- setData() : self
- Set the extra data properties of the parameter or set a specific extra property
- setDefault() : self
- Set the default value of the parameter
- setDescription() : self
- Set the description of the parameter
- setEnum() : self
- Set the enum of strings that are valid for the parameter
- setFilters() : self
- Set the array of filters used by the parameter
- setFormat() : self
- Set the format attribute of the schema
- setInstanceOf() : self
- Set the class that the parameter must be an instance of
- setItems() : self
- Set the items data of the parameter
- setLocation() : self
- Set the location of the parameter
- setMaximum() : self
- Set the maximum acceptable value for an integer
- setMaxItems() : self
- Set the maximum allowed number of items in an array value
- setMaxLength() : self
- Set the maximum allowed length of a string value
- setMinimum() : self
- Set the minimum acceptable value for an integer
- setMinItems() : self
- Set the minimum allowed number of items in an array value
- setMinLength() : self
- Set the minimum allowed length of a string value
- setName() : self
- Set the name of the parameter
- setParent() : self
- Set the parent object of the parameter
- setPattern() : self
- Set the regex pattern that must match a value when the value is a string
- setRequired() : self
- Set if the parameter is required
- setSentAs() : self
- Set the sentAs attribute
- setStatic() : self
- Set to true if the default value cannot be changed
- setType() : self
- Set the type(s) of the parameter
- toArray() : array<string|int, mixed>
- Convert the object to an array
Properties
$additionalProperties
protected
mixed
$additionalProperties
$data
protected
mixed
$data
$default
protected
mixed
$default
$description
protected
mixed
$description
$enum
protected
mixed
$enum
$filters
protected
mixed
$filters
$format
protected
mixed
$format
$instanceOf
protected
mixed
$instanceOf
$items
protected
mixed
$items
$location
protected
mixed
$location
$maximum
protected
mixed
$maximum
$maxItems
protected
mixed
$maxItems
$maxLength
protected
mixed
$maxLength
$minimum
protected
mixed
$minimum
$minItems
protected
mixed
$minItems
$minLength
protected
mixed
$minLength
$name
protected
mixed
$name
$parent
protected
mixed
$parent
$pattern
protected
mixed
$pattern
$properties
protected
mixed
$properties
= array()
$propertiesCache
protected
mixed
$propertiesCache
= null
$ref
protected
mixed
$ref
$required
protected
mixed
$required
$sentAs
protected
mixed
$sentAs
$serviceDescription
protected
mixed
$serviceDescription
$static
protected
mixed
$static
$type
protected
mixed
$type
Methods
__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.
public
__construct([array<string|int, mixed> $data = array() ][, ServiceDescriptionInterface $description = null ]) : mixed
- 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<string|int, mixed> = array()
-
Array of data as seen in service descriptions
- $description : ServiceDescriptionInterface = null
-
Service description used to resolve models if $ref tags are found
Tags
addFilter()
Add a filter to the parameter
public
addFilter(string|array<string|int, mixed> $filter) : self
Parameters
- $filter : string|array<string|int, mixed>
-
Method to filter the value through
Tags
Return values
selfaddProperty()
Add a property to the parameter
public
addProperty(Parameter $property) : self
Parameters
- $property : Parameter
-
Properties to set
Return values
selffilter()
Run a value through the filters OR format attribute associated with the parameter
public
filter(mixed $value) : mixed
Parameters
- $value : mixed
-
Value to filter
Return values
mixed —Returns the filtered value
getAdditionalProperties()
Get the additionalProperties value of the parameter
public
getAdditionalProperties() : bool|Parameter|null
Return values
bool|Parameter|nullgetData()
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
getData([string|null $name = null ]) : array<string|int, mixed>|mixed|null
Parameters
- $name : string|null = null
-
Specify a particular property name to retrieve
Return values
array<string|int, mixed>|mixed|nullgetDefault()
Get the default value of the parameter
public
getDefault() : string|null
Return values
string|nullgetDescription()
Get the description of the parameter
public
getDescription() : string|null
Return values
string|nullgetEnum()
Get the enum of strings that are valid for the parameter
public
getEnum() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullgetFilters()
Get an array of filters used by the parameter
public
getFilters() : array<string|int, mixed>
Return values
array<string|int, mixed>getFormat()
Get the format attribute of the schema
public
getFormat() : string
Return values
stringgetInstanceOf()
Get the class that the parameter must implement
public
getInstanceOf() : null|string
Return values
null|stringgetItems()
Get the item data of the parameter
public
getItems() : Parameter|null
Return values
Parameter|nullgetLocation()
Get the location of the parameter
public
getLocation() : string|null
Return values
string|nullgetMaximum()
Get the maximum acceptable value for an integer
public
getMaximum() : int|null
Return values
int|nullgetMaxItems()
Get the maximum allowed number of items in an array value
public
getMaxItems() : int|null
Return values
int|nullgetMaxLength()
Get the maximum allowed length of a string value
public
getMaxLength() : int|null
Return values
int|nullgetMinimum()
Get the minimum acceptable value for an integer
public
getMinimum() : int|null
Return values
int|nullgetMinItems()
Get the minimum allowed number of items in an array value
public
getMinItems() : int
Return values
intgetMinLength()
Get the minimum allowed length of a string value
public
getMinLength() : int
Return values
intgetName()
Get the name of the parameter
public
getName() : string
Return values
stringgetParent()
Get the parent object (an {@see OperationInterface} or {@see Parameter}
public
getParent() : OperationInterface|Parameter|null
Return values
OperationInterface|Parameter|nullgetPattern()
Get the regex pattern that must match a value when the value is a string
public
getPattern() : string
Return values
stringgetProperties()
Get the properties of the parameter
public
getProperties() : array<string|int, mixed>
Return values
array<string|int, mixed>getProperty()
Get a specific property from the parameter
public
getProperty(string $name) : null|Parameter
Parameters
- $name : string
-
Name of the property to retrieve
Return values
null|ParametergetRequired()
Get if the parameter is required
public
getRequired() : bool
Return values
boolgetSentAs()
Get the sentAs attribute of the parameter that used with locations to sentAs an attribute when it is being applied to a location.
public
getSentAs() : string|null
Return values
string|nullgetStatic()
Get whether or not the default value can be changed
public
getStatic() : mixed|null
Return values
mixed|nullgetType()
Get the type(s) of the parameter
public
getType() : string|array<string|int, mixed>
Return values
string|array<string|int, mixed>getValue()
Get the default or static value of the command based on a value
public
getValue(string $value) : mixed
Parameters
- $value : string
-
Value that is currently set
Return values
mixed —Returns the value, a static value if one is present, or a default value
getWireName()
Get the key of the parameter, where sentAs will supersede name if it is set
public
getWireName() : string
Return values
stringremoveProperty()
Remove a property from the parameter
public
removeProperty(string $name) : self
Parameters
- $name : string
-
Name of the property to remove
Return values
selfsetAdditionalProperties()
Set the additionalProperties value of the parameter
public
setAdditionalProperties(bool|Parameter|null $additional) : self
Parameters
- $additional : bool|Parameter|null
-
Boolean to allow any, an Parameter to specify a schema, or false to disallow
Return values
selfsetData()
Set the extra data properties of the parameter or set a specific extra property
public
setData(string|array<string|int, mixed>|null $nameOrData[, mixed|null $data = null ]) : self
Parameters
- $nameOrData : string|array<string|int, mixed>|null
-
The name of a specific extra to set or an array of extras to set
- $data : mixed|null = null
-
When setting a specific extra property, specify the data to set for it
Return values
selfsetDefault()
Set the default value of the parameter
public
setDefault(string|null $default) : self
Parameters
- $default : string|null
-
Default value to set
Return values
selfsetDescription()
Set the description of the parameter
public
setDescription(string $description) : self
Parameters
- $description : string
-
Description
Return values
selfsetEnum()
Set the enum of strings that are valid for the parameter
public
setEnum([array<string|int, mixed>|null $enum = null ]) : self
Parameters
- $enum : array<string|int, mixed>|null = null
-
Array of strings or null
Return values
selfsetFilters()
Set the array of filters used by the parameter
public
setFilters(array<string|int, mixed> $filters) : self
Parameters
- $filters : array<string|int, mixed>
-
Array of functions to use as filters
Return values
selfsetFormat()
Set the format attribute of the schema
public
setFormat(string $format) : self
Parameters
- $format : string
-
Format to set (e.g. date, date-time, timestamp, time, date-time-http)
Return values
selfsetInstanceOf()
Set the class that the parameter must be an instance of
public
setInstanceOf(string|null $instanceOf) : self
Parameters
- $instanceOf : string|null
-
Class or interface name
Return values
selfsetItems()
Set the items data of the parameter
public
setItems([Parameter|null $items = null ]) : self
Parameters
- $items : Parameter|null = null
-
Items to set
Return values
selfsetLocation()
Set the location of the parameter
public
setLocation(string|null $location) : self
Parameters
- $location : string|null
-
Location of the parameter
Return values
selfsetMaximum()
Set the maximum acceptable value for an integer
public
setMaximum(int $max) : self
Parameters
- $max : int
-
Maximum
Return values
selfsetMaxItems()
Set the maximum allowed number of items in an array value
public
setMaxItems(int $max) : self
Parameters
- $max : int
-
Maximum
Return values
selfsetMaxLength()
Set the maximum allowed length of a string value
public
setMaxLength(int $max) : self
Parameters
- $max : int
-
Maximum length
Return values
selfsetMinimum()
Set the minimum acceptable value for an integer
public
setMinimum(int|null $min) : self
Parameters
- $min : int|null
-
Minimum
Return values
selfsetMinItems()
Set the minimum allowed number of items in an array value
public
setMinItems(int|null $min) : self
Parameters
- $min : int|null
-
Minimum
Return values
selfsetMinLength()
Set the minimum allowed length of a string value
public
setMinLength(int|null $min) : self
Parameters
- $min : int|null
-
Minimum
Return values
selfsetName()
Set the name of the parameter
public
setName(string $name) : self
Parameters
- $name : string
-
Name to set
Return values
selfsetParent()
Set the parent object of the parameter
public
setParent(OperationInterface|Parameter|null $parent) : self
Parameters
- $parent : OperationInterface|Parameter|null
-
Parent container of the parameter
Return values
selfsetPattern()
Set the regex pattern that must match a value when the value is a string
public
setPattern(string $pattern) : self
Parameters
- $pattern : string
-
Regex pattern
Return values
selfsetRequired()
Set if the parameter is required
public
setRequired(bool $isRequired) : self
Parameters
- $isRequired : bool
-
Whether or not the parameter is required
Return values
selfsetSentAs()
Set the sentAs attribute
public
setSentAs(string|null $name) : self
Parameters
- $name : string|null
-
Name of the value as it is sent over the wire
Return values
selfsetStatic()
Set to true if the default value cannot be changed
public
setStatic(bool $static) : self
Parameters
- $static : bool
-
True or false
Return values
selfsetType()
Set the type(s) of the parameter
public
setType(string|array<string|int, mixed> $type) : self
Parameters
- $type : string|array<string|int, mixed>
-
Type of parameter or array of simple types used in a union
Return values
selftoArray()
Convert the object to an array
public
toArray() : array<string|int, mixed>