@param CachedReader     $reader
@param \ReflectionClass $controllerReflClass

@return array
179967
private function buildRouteDefinition(CachedReader $reader, \ReflectionClass $controllerReflClass)
    {
        $routeDefinitions = [];

        if ($controllerReflClass->isInstantiable()) {
            $annotations = $reader->getClassAnnotations($controllerReflClass);
            foreach ($annotations as $annotation) {
                if ($annotation instanceof Route) {
                    $annotation->controller = $controllerReflClass->getName();
                    $this->autoDetectEntity($annotation);
                    $routeDefinitions[] = (array)$annotation;
                }
            }

            foreach ($controllerReflClass->getMethods() as $method) {
                $annotations = $reader->getMethodAnnotations($method);
                foreach ($annotations as $annotation) {
                    if ($annotation instanceof Route) {
                        $annotation->controller = $controllerReflClass->getName();
                        $annotation->method = $method->getName();
                        $this->autoDetectEntity($annotation);
                        $routeDefinitions[] = (array)$annotation;
                    }
                }
            }
        }

        return $routeDefinitions;
    }
1363937
public function serializePayload(ControllerContext $controllerContext)
    {
        return [
            'contextPath' => $this->getNode()->getContextPath(),
            'nodeDomAddress' => $this->getNodeDomAddress(),
            'renderedContent' => $this->renderContent($controllerContext)
        ];
    }
1275953
public function getContextValue(HasNodeInterface $page, array $context)
    {
        $controllerClass = substr(str_replace('Entity', 'Controller', ClassLookup::getClass($page)), 0, -strlen('Page')) . 'Controller';

        if (false === class_exists($controllerClass)) {
            return [];
        }

        /** @var PageControllerInterface|ContainerAwareInterface $controller */
        $controller = $this->container->has($controllerClass)
            ? $this->container->get($controllerClass)
            : new $controllerClass;

        if (false === $controller instanceof PageControllerInterface) {
            throw new \RuntimeException("$controllerClass needs to implement " . PageControllerInterface::class);
        }

        if ($controller instanceof ContainerAwareInterface) {
            $controller->setContainer($this->container);
        }

        return $controller->serviceAction($page, $context);
    }
533645
private void createReadCaches() {
		recalculateSizeReadCaches();
		if (log.isDebugEnabled()) {
			log.debug(this.getClass().getName() + "::createReadCaches readCacheInternal=" + readCacheInternal
					+ " readCacheLeaf=" + readCacheLeaf);
		}
		cacheInternalNodes = createCacheLRUlinked(readCacheInternal);
		cacheLeafNodes = createCacheLRUlinked(readCacheLeaf);
	}
643422
public function read(\ReflectionClass $reflectionClass)
    {
        $collection = new RestRouteCollection();
        $collection->addResource(new FileResource($reflectionClass->getFileName()));

        // read prefix annotation
        if ($annotation = $this->annotationReader->getClassAnnotation($reflectionClass, Annotations\Prefix::class)) {
            $this->actionReader->setRoutePrefix($annotation->value);
        }

        // read name-prefix annotation
        if ($annotation = $this->annotationReader->getClassAnnotation($reflectionClass, Annotations\NamePrefix::class)) {
            $this->actionReader->setNamePrefix($annotation->value);
        }

        // read version annotation
        if ($annotation = $this->annotationReader->getClassAnnotation($reflectionClass, Annotations\Version::class)) {
            $this->actionReader->setVersions($annotation->value);
        }

        $resource = [];
        // read route-resource annotation
        if ($annotation = $this->annotationReader->getClassAnnotation($reflectionClass, Annotations\RouteResource::class)) {
            $resource = explode('_', $annotation->resource);
            $this->actionReader->setPluralize($annotation->pluralize);
        } elseif ($reflectionClass->implementsInterface(ClassResourceInterface::class)) {
            $resource = preg_split(
                '/([A-Z][^A-Z]*)Controller/', $reflectionClass->getShortName(), -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
            );
            if (empty($resource)) {
                throw new \InvalidArgumentException("Controller '{$reflectionClass->name}' does not identify a resource");
            }
        }

        // trim '/' at the start of the prefix
        if ('/' === substr($prefix = $this->actionReader->getRoutePrefix(), 0, 1)) {
            $this->actionReader->setRoutePrefix(substr($prefix, 1));
        }

        // read action routes into collection
        foreach ($reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
            $this->actionReader->read($collection, $method, $resource);
        }

        $this->actionReader->setRoutePrefix(null);
        $this->actionReader->setNamePrefix(null);
        $this->actionReader->setVersions(null);
        $this->actionReader->setPluralize(null);
        $this->actionReader->setParents([]);

        return $collection;
    }
1228521
public function syncData($controller_data)
    {
        if (is_object($controller_data)) {
            $handler_data = $this->legacy_handler->getData();

            $refl_class = new \ReflectionClass(get_class($handler_data));
            $filter     = \ReflectionProperty::IS_PUBLIC
                | \ReflectionProperty::IS_PROTECTED
                | \ReflectionProperty::IS_PRIVATE;

            foreach ($refl_class->getProperties($filter) as $property) {
                $property->setAccessible(true);
                $property->setValue($handler_data, $property->getValue($controller_data));
                $property->setAccessible(false);
            }
        }

        return $this->legacy_handler->getData();
    }
994344
public function getControllersAnnotationReader() {
		$AnnotationReader = new \Asgard\Http\AnnotationReader;
		if($this->getCache())
			$AnnotationReader->setCache($this->getCache());
		$AnnotationReader->setDebug($this->getConfig()['debug']);
		return $AnnotationReader;
	}
1342536
public function embedded(GenericReadModelMapper $readModelMapper) : EmbeddedReadModelAliasDefiner
    {
        $this->verifyClassDefined(__METHOD__);
        $this->verifyMapperDefined(__METHOD__);

        return new EmbeddedReadModelAliasDefiner(function ($alias) use ($readModelMapper) {
            $mapper = $readModelMapper->loadMapperFor($this->mapper);

            $this->readDefinition->embedded($alias)->using($mapper);
        });
    }
1130515
public function parseReflectedController($name, ClassReflection $reflection, ArrayObject $config)
    {
        $annotations = $reflection->getAnnotations($this->annotationManager);

        if ($annotations instanceof AnnotationCollection) {
            $this->processor->processController($name, $annotations);
        }

        foreach ($reflection->getMethods() as $method) {
            $annotations = $method->getAnnotations($this->annotationManager);

            if (!$annotations instanceof AnnotationCollection) {
                continue;
            }

            $this->processor->processMethod($method->getName(), $annotations, $config);
        }

        return $config;
    }
391592
private function readFilterAnnotations(\ReflectionClass $reflectionClass, Reader $reader): array
    {
        $filters = [];

        foreach ($this->getFilterAnnotations($reader->getClassAnnotations($reflectionClass)) as $filterAnnotation) {
            $filterClass = $filterAnnotation->filterClass;
            $id = $this->generateFilterId($reflectionClass, $filterClass, $filterAnnotation->id);

            if (!isset($filters[$id])) {
                $filters[$id] = [$filterAnnotation->arguments, $filterClass];
            }

            if ($properties = $this->getFilterProperties($filterAnnotation, $reflectionClass)) {
                $filters[$id][0]['properties'] = $properties;
            }
        }

        foreach ($reflectionClass->getProperties() as $reflectionProperty) {
            foreach ($this->getFilterAnnotations($reader->getPropertyAnnotations($reflectionProperty)) as $filterAnnotation) {
                $filterClass = $filterAnnotation->filterClass;
                $id = $this->generateFilterId($reflectionClass, $filterClass, $filterAnnotation->id);

                if (!isset($filters[$id])) {
                    $filters[$id] = [$filterAnnotation->arguments, $filterClass];
                }

                if ($properties = $this->getFilterProperties($filterAnnotation, $reflectionClass, $reflectionProperty)) {
                    if (isset($filters[$id][0]['properties'])) {
                        $filters[$id][0]['properties'] = array_merge($filters[$id][0]['properties'], $properties);
                    } else {
                        $filters[$id][0]['properties'] = $properties;
                    }
                }
            }
        }

        $parent = $reflectionClass->getParentClass();

        if (false !== $parent) {
            return array_merge($filters, $this->readFilterAnnotations($parent, $reader));
        }

        return $filters;
    }
211483
public function get_cached_model($path, array $data, mvc\controller $ctrl, $ttl = 10){
    if ( \is_null($data) ){
      $data = $this->data;
    }
    if ( $route = $this->router->route($path, 'model') ){
      $model = new mvc\model($this->db, $route, $ctrl, $this);
      return $model->get_from_cache($data, '', $ttl);
    }
    return [];
  }
552002
public static function getAnnotationReader()
    {
        if (self::$annotationReader === null) {
            self::$annotationReader = new CachedReader(new AnnotationReader(), new ArrayCache());
        }

        return self::$annotationReader;
    }
1024960
private function getServiceFromNamespaces($controllerClass)
    {
        foreach ($this->get(self::KEY_NAMESPACES) as $namespace) {
            $fullClass = sprintf('%s\\%s', $namespace, $controllerClass);
            if (class_exists($fullClass)) {
                return new $fullClass();
            }
        }
        throw new Exception('Controller class '.$controllerClass.' was not found in any listed namespace.');
    }
288242
public function getResultCacheDriver()
    {
        if (!$this->resultCacheDriver instanceof CacheProvider) {
            $this->resultCacheDriver = $this->getCacheDriver(
                (string) $this->getOption('result_cache_namespace'),
                $this->getOption('result_cache_driver')
            );
        }

        return $this->resultCacheDriver;
    }
332643
private function getData(Reader $reader)
    {
        $size = $this->getSize($reader);

        $reader->seek(0);

        return $reader->read($reader->getSize() - 12 - $size);
    }
1273386
public function getControllerGenerator()
    {
        if (null == $this->controllerGenerator) {
            $class = $this->getTaskClass();
            $this->setControllerGenerator(
                new $class([
                    'entityName' => $this->getEntityName(),
                    'controllerName' => $this->getControllerName(),
                    'sourcePath' => $this->getPath(),
                    'namespace' => $this->getNameSpace()
                ])
            );
        }
        return $this->controllerGenerator;
    }
502811
protected function &getReadClients(&$read)
    {
        $clients = array();

        foreach ($this->clients as $client) {
            if (in_array($client->getSocket()->getRawSocket(), $read)) {
                $clients[] = $client;
            }
        }

        return $clients;
    }