Ejemplo n.º 1
0
 /**
  * Extracts collected route collections from the message response.
  * @param \Brickoo\Component\Common\ArrayList $messageResponseList
  * @return \Brickoo\Component\Common\Collection
  */
 private function extractRouteCollections(ArrayList $messageResponseList)
 {
     $collection = new Collection();
     foreach ($messageResponseList as $item) {
         if ($item instanceof RouteCollection) {
             $collection->add($item);
         }
     }
     return $collection;
 }
Ejemplo n.º 2
0
 /** {@inheritDoc} */
 public function collect()
 {
     $filePaths = $this->collectRouteCollectionsFilePaths();
     $collection = new Collection();
     foreach ($filePaths as $filePath) {
         if (($routeCollection = $this->getRouteCollectionFromFilePath($filePath)) && $routeCollection instanceof RouteCollection) {
             $collection->add($routeCollection);
         }
     }
     return $collection;
 }
<?php

use Brickoo\Component\Annotation\Annotation;
use Brickoo\Component\Annotation\Definition\AnnotationDefinition;
use Brickoo\Component\Annotation\Definition\AnnotationParameterDefinition;
use Brickoo\Component\Common\Collection;
/**
 * Definition annotations:
 * @Controller (path = "/")
 * @Route (path = "/list")
 * @Assert (maxlength = 30)
 */
$collection = new Collection();
$annotation = new AnnotationDefinition("Controller", Annotation::TARGET_CLASS);
$annotation->addParameter(new AnnotationParameterDefinition("path", "string"));
$collection->add($annotation);
$annotation = new AnnotationDefinition("Route", Annotation::TARGET_METHOD);
$annotation->addParameter(new AnnotationParameterDefinition("path", "string"));
$collection->add($annotation);
$annotation = new AnnotationDefinition("Assert", Annotation::TARGET_PROPERTY);
$annotation->addParameter(new AnnotationParameterDefinition("maxlength", "integer"));
$collection->add($annotation);
return $collection;