PHP Class Swagger\Annotations\AbstractAnnotation

Inheritance: implements JsonSerializabl\JsonSerializable
Exibir arquivo Open project: zircote/swagger-php Class Usage Examples

Public Properties

Property Type Description
$_blacklist array List of properties are blacklisted from the JSON output.
$_context Swagger\Context
$_nested array Examples: 'Swagger\Annotation\Info' => 'info', // Set @SWG\Info annotation as the info property. 'Swagger\Annotation\Parameter' => ['parameters'], // Append @SWG\Parameter annotations the parameters array. 'Swagger\Annotation\Path' => ['paths', 'path'], // Append @SWG\Path annotations the paths array and use path as key.
$_parents string[] Reverse mapping of $_nested with the allowed parent annotations.
$_required array The properties which are required by the spec
$_types array Examples: 'name' => 'string' // a string 'required' => 'boolean', // true or false 'tags' => '[string]', // array containing strings 'in' => ["query", "header", "path", "formData", "body"] // must be one on these
$_unmerged array Annotations that couldn't be merged by mapping or postprocessing.
$x array The keys inside the array will be prefixed with x-. For further details see https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#vendorExtensions.

Public Methods

Method Description
__construct ( array $properties )
__debugInfo ( )
__get ( $property )
__set ( $property, $value )
__toString ( )
identity ( ) : string Return a identity for easy debugging.
jsonSerialize ( ) : array Customize the way json_encode() renders the annotations.
merge ( AbstractAnnotation[] $annotations, boolean $ignore = false ) : AbstractAnnotation[] Merge given annotations to their mapped properties configured in static::$_nested.
mergeProperties ( object $object ) Merge the properties from the given object into this annotation.
validate ( array $parents = [], array $skip = [] ) : boolean Validate annotation tree, and log notices & warnings.

Protected Methods

Method Description
_identity ( array $properties ) : string Helper for generating the identity()

Private Methods

Method Description
_validate ( array | object $fields, array $path, $skip ) : boolean Recursively validate all annotation properties.
nested ( AbstractAnnotation $annotation, Context $nestedContext ) : AbstractAnnotation Wrap the context with a reference to the annotation it is nested in.
validateType ( $type, $value )

Method Details

__construct() public method

public __construct ( array $properties )
$properties array

__debugInfo() public method

public __debugInfo ( )

__get() public method

public __get ( $property )

__set() public method

public __set ( $property, $value )

__toString() public method

public __toString ( )

_identity() protected method

Helper for generating the identity()
protected _identity ( array $properties ) : string
$properties array
return string

identity() public method

Example: "@SWG\Get(path="/pets")"
public identity ( ) : string
return string

jsonSerialize() public method

Customize the way json_encode() renders the annotations.
public jsonSerialize ( ) : array
return array

merge() public method

Annotations that couldn't be merged are added to the _unmerged array.
public merge ( AbstractAnnotation[] $annotations, boolean $ignore = false ) : AbstractAnnotation[]
$annotations AbstractAnnotation[]
$ignore boolean Ignore unmerged annotations
return AbstractAnnotation[] The unmerged annotations

mergeProperties() public method

Prevents overwriting properties that are already configured.
public mergeProperties ( object $object )
$object object

validate() public method

Validate annotation tree, and log notices & warnings.
public validate ( array $parents = [], array $skip = [] ) : boolean
$parents array The path of annotations above this annotation in the tree.
$skip array (prevent stack overflow, when traversing an infinite dependency graph)
return boolean

Property Details

$_blacklist public_oe static_oe property

List of properties are blacklisted from the JSON output.
public static array $_blacklist
return array

$_context public_oe property

public Context,Swagger $_context
return Swagger\Context

$_nested public_oe static_oe property

Examples: 'Swagger\Annotation\Info' => 'info', // Set @SWG\Info annotation as the info property. 'Swagger\Annotation\Parameter' => ['parameters'], // Append @SWG\Parameter annotations the parameters array. 'Swagger\Annotation\Path' => ['paths', 'path'], // Append @SWG\Path annotations the paths array and use path as key.
public static array $_nested
return array

$_parents public_oe static_oe property

Reverse mapping of $_nested with the allowed parent annotations.
public static string[] $_parents
return string[]

$_required public_oe static_oe property

The properties which are required by the spec
public static array $_required
return array

$_types public_oe static_oe property

Examples: 'name' => 'string' // a string 'required' => 'boolean', // true or false 'tags' => '[string]', // array containing strings 'in' => ["query", "header", "path", "formData", "body"] // must be one on these
public static array $_types
return array

$_unmerged public_oe property

Annotations that couldn't be merged by mapping or postprocessing.
public array $_unmerged
return array

$x public_oe property

The keys inside the array will be prefixed with x-. For further details see https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#vendorExtensions.
public array $x
return array