- Phalcon\Annotations\Adapter\AbstractAdapter
- Phalcon\Annotations\Adapter\AdapterInterface
- Phalcon\Annotations\Adapter\Apcu
- Phalcon\Annotations\Adapter\Memory
- Phalcon\Annotations\Adapter\Stream
- Phalcon\Annotations\Annotation
- Phalcon\Annotations\AnnotationsFactory
- Phalcon\Annotations\Collection
- Phalcon\Annotations\Exception
- Phalcon\Annotations\Reader
- Phalcon\Annotations\ReaderInterface
- Phalcon\Annotations\Reflection
Abstract Class Phalcon\Annotations\Adapter\AbstractAdapter
| Namespace | Phalcon\Annotations\Adapter | | Uses | Phalcon\Annotations\Reader, Phalcon\Annotations\Exception, Phalcon\Annotations\Collection, Phalcon\Annotations\Reflection, Phalcon\Annotations\ReaderInterface | | Implements | AdapterInterface |
This is the base class for Phalcon\Annotations adapters
Properties¶
Methods¶
Parses or retrieves all the annotations found in a class Returns the annotations found in a specific method Returns the annotations found in all the class' methods Returns the annotations found in all the class' methods Returns the annotations found in a specific property Returns the annotation reader Sets the annotations parserInterface Phalcon\Annotations\Adapter\AdapterInterface
| Namespace | Phalcon\Annotations\Adapter | | Uses | Phalcon\Annotations\Reflection, Phalcon\Annotations\Collection, Phalcon\Annotations\ReaderInterface |
This interface must be implemented by adapters in Phalcon\Annotations
Methods¶
Parses or retrieves all the annotations found in a class Returns the annotations found in a specific method Returns the annotations found in all the class' methods Returns the annotations found in all the class' methods Returns the annotations found in a specific property Returns the annotation reader Sets the annotations parserClass Phalcon\Annotations\Adapter\Apcu
| Namespace | Phalcon\Annotations\Adapter | | Uses | Phalcon\Annotations\Reflection | | Extends | AbstractAdapter |
Stores the parsed annotations in APCu. This adapter is suitable for production
Properties¶
Methods¶
Reads parsed annotations from APCu Writes parsed annotations to APCuClass Phalcon\Annotations\Adapter\Memory
| Namespace | Phalcon\Annotations\Adapter | | Uses | Phalcon\Annotations\Reflection | | Extends | AbstractAdapter |
Stores the parsed annotations in memory. This adapter is the suitable development/testing
Properties¶
Methods¶
Reads parsed annotations from memory Writes parsed annotations to memoryClass Phalcon\Annotations\Adapter\Stream
| Namespace | Phalcon\Annotations\Adapter | | Uses | Phalcon\Annotations\Reflection, Phalcon\Annotations\Exception, RuntimeException | | Extends | AbstractAdapter |
Stores the parsed annotations in files. This adapter is suitable for production
use Phalcon\Annotations\Adapter\Stream;
$annotations = new Stream(
[
"annotationsDir" => "app/cache/annotations/",
]
);
Properties¶
Methods¶
Reads parsed annotations from files Writes parsed annotations to filesClass Phalcon\Annotations\Annotation
| Namespace | Phalcon\Annotations |
Represents a single annotation in an annotations collection
Properties¶
/**
* Annotation Arguments
*
* @var array
*/
protected arguments;
/**
* Annotation ExprArguments
*
* @var array
*/
protected exprArguments;
/**
* Annotation Name
*
* @var string|null
*/
protected name;
Methods¶
Phalcon\Annotations\Annotation constructor Returns an argument in a specific position Returns the expression arguments Returns the expression arguments without resolving Resolves an annotation expression Returns the annotation's name Returns a named argument Returns a named parameter Returns an argument in a specific position Returns the number of arguments that the annotation hasClass Phalcon\Annotations\AnnotationsFactory
| Namespace | Phalcon\Annotations | | Uses | Phalcon\Annotations\Adapter\AdapterInterface, Phalcon\Factory\AbstractFactory, Phalcon\Helper\Arr | | Extends | AbstractFactory |
Factory to create annotations components
Methods¶
AdapterFactory constructor. Create a new instance of the adapter The available adaptersClass Phalcon\Annotations\Collection
| Namespace | Phalcon\Annotations | | Uses | Countable, Iterator | | Implements | Iterator, Countable |
Represents a collection of annotations. This class allows to traverse a group of annotations easily
// Traverse annotations
foreach ($classAnnotations as $annotation) {
echo "Name=", $annotation->getName(), PHP_EOL;
}
// Check if the annotations has a specific
var_dump($classAnnotations->has("Cacheable"));
// Get an specific annotation in the collection
$annotation = $classAnnotations->get("Cacheable");
Properties¶
Methods¶
Phalcon\Annotations\Collection constructor Returns the number of annotations in the collection Returns the current annotation in the iterator Returns the first annotation that match a name Returns all the annotations that match a name Returns the internal annotations as an array Check if an annotation exists in a collection Returns the current position/key in the iterator Moves the internal iteration pointer to the next position Rewinds the internal iterator Check if the current annotation in the iterator is validClass Phalcon\Annotations\Exception
| Namespace | Phalcon\Annotations | | Extends | \Phalcon\Exception |
Class for exceptions thrown by Phalcon\Annotations
Class Phalcon\Annotations\Reader
| Namespace | Phalcon\Annotations | | Uses | ReflectionClass | | Implements | ReaderInterface |
Parses docblocks returning an array with the found annotations
Methods¶
Reads annotations from the class docblocks, its methods and/or propertiespublic static function parseDocBlock( string $docBlock, mixed $file = null, mixed $line = null ): array;
Interface Phalcon\Annotations\ReaderInterface
| Namespace | Phalcon\Annotations |
Parses docblocks returning an array with the found annotations
Methods¶
Reads annotations from the class docblocks, its methods and/or propertiespublic static function parseDocBlock( string $docBlock, mixed $file = null, mixed $line = null ): array;
Class Phalcon\Annotations\Reflection
| Namespace | Phalcon\Annotations |
Allows to manipulate the annotations reflection in an OO manner
use Phalcon\Annotations\Reader;
use Phalcon\Annotations\Reflection;
// Parse the annotations in a class
$reader = new Reader();
$parsing = $reader->parse("MyComponent");
// Create the reflection
$reflection = new Reflection($parsing);
// Get the annotations in the class docblock
$classAnnotations = $reflection->getClassAnnotations();
Properties¶
//
protected classAnnotations;
//
protected methodAnnotations;
//
protected propertyAnnotations;
/**
* @var array
*/
protected reflectionData;