Properties

$defaultNamespace

$defaultNamespace : string

Stores the default namespace for Objects instance, usually used on methods like getMethodAnnotationsObjects()

Type

string

$annotationCache

$annotationCache : array

Static array to store already parsed annotations

Type

array

$strict

$strict : boolean

Indicates that annotations should has strict behavior, 'false' by default

Type

boolean

Methods

setStrict()

setStrict(boolean  $value) 

Sets strict variable to true/false

Parameters

boolean $value

boolean value to indicate that annotations to has strict behavior

setDefaultNamespace()

setDefaultNamespace(string  $namespace) 

Sets default namespace to use in object instantiation

Parameters

string $namespace

default namespace

getDefaultAnnotationNamespace()

getDefaultAnnotationNamespace() : string

Gets default namespace used in object instantiation

Returns

string —

$namespace default namespace

getClassAnnotations()

getClassAnnotations(string  $className) : array

Gets all anotations with pattern @SomeAnnotation() from a given class

Parameters

string $className

class name to get annotations

Returns

array —

self::$annotationCache all annotated elements

getAllClassAnnotations()

getAllClassAnnotations(  $className) 

Parameters

$className

getMethodAnnotations()

getMethodAnnotations(string  $className, string  $methodName) : array

Gets all anotations with pattern @SomeAnnotation() from a determinated method of a given class

Parameters

string $className

class name

string $methodName

method name to get annotations

Returns

array —

self::$annotationCache all annotated elements of a method given

getMethodAnnotationsObjects()

getMethodAnnotationsObjects(string  $className, string  $methodName) : array

Gets all anotations with pattern @SomeAnnotation() from a determinated method of a given class and instance its abcAnnotation class

Parameters

string $className

class name

string $methodName

method name to get annotations

Returns

array —

self::$annotationCache all annotated objects of a method given

consolidateAnnotations()

consolidateAnnotations(  $method,   $class) 

Parameters

$method
$class

parseCustomAnnotations()

parseCustomAnnotations(string  $docblock, string  $name = 'param') : array

Parse annotations

Parameters

string $docblock
string $name

Returns

array —

parsed annotations params

parseAnnotations()

parseAnnotations(string  $docblock) : array

Parse annotations

Parameters

string $docblock

Returns

array —

parsed annotations params

parseArgs()

parseArgs(string  $content) : array

Parse individual annotation arguments

Parameters

string $content

arguments string

Returns

array —

annotated arguments

castValue()

castValue(string  $val, boolean  $trim = false) : mixed

Try determinate the original type variable of a string

Parameters

string $val

string containing possibles variables that can be cast to bool or int

boolean $trim

indicate if the value passed should be trimmed after to try cast

Returns

mixed —

returns the value converted to original type if was possible