多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# Class **Phalcon\Annotations\Collection**[](# "永久链接至标题") *implements* Iterator, Traversable, Countable Represents a collection of annotations. This class allows to traverse a group of annotations easily ~~~ <?php //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'); ~~~ ### Methods[](# "永久链接至标题") public **__construct** ([*array* $reflectionData]) Phalcon\Annotations\Collection constructor public **count** () Returns the number of annotations in the collection public **rewind** () Rewinds the internal iterator public [*Phalcon\Annotations\Annotation*](#)**current** () Returns the current annotation in the iterator public **key** () Returns the current position/key in the iterator public **next** () Moves the internal iteration pointer to the next position public **valid** () Check if the current annotation in the iterator is valid public **getAnnotations** () Returns the internal annotations as an array public **get** (*unknown* $name) Returns the first annotation that match a name public **getAll** (*unknown* $name) Returns all the annotations that match a name public **has** (*unknown* $name) Check if an annotation exists in a collection | - [索引](# "总目录") - [下一页](# "Class Phalcon\Annotations\Exception") | - [上一页](# "Class Phalcon\Annotations\Annotation") | - [API Indice](#) »