/** * Constructor * * @param InjectorInterface $injector Dependency Injector * @param ResourceInterface $resource Resource client * @param ExceptionHandlerInterface $exceptionHandler Exception handler * @param ResponseInterface $response Web / Console response * @param CacheAdapterInterface $cache Resource cache adapter * @param ApplicationLogger $logger Application logger * * @Inject * @Named("cache=resource_cache") */ public function __construct(InjectorInterface $injector, ResourceInterface $resource, ExceptionHandlerInterface $exceptionHandler, ResponseInterface $response, CacheAdapterInterface $cache = null, ApplicationLogger $logger = null) { $this->injector = $injector; $this->resource = $resource; $this->response = $response; $this->exceptionHandler = $exceptionHandler; $this->cache = $cache; $this->logger = $logger; $resource->attachParamProvider('Provides', new Provides()); if ($this->cache instanceof CacheAdapterInterface) { $resource->setCacheAdapter($this->cache); } }
/** * Constructor * * @param \Ray\Di\InjectorInterface $injector Dependency Injector * @param \BEAR\Resource\ResourceInterface $resource Resource client * @param \BEAR\Package\ExceptionHandle\ExceptionHandlerInterface $exceptionHandler Exception handler * @param \BEAR\Sunday\Application\Logger $logger Application logger * @param \BEAR\Sunday\Web\ResponseInterface $response Web / Console response * @param \BEAR\Sunday\Web\RouterInterface $router Resource cache adapter * @param \BEAR\Sunday\Web\GlobalsInterface $globals GLOBALS value * * @Inject */ public function __construct(InjectorInterface $injector, ResourceInterface $resource, ExceptionHandlerInterface $exceptionHandler, ApplicationLogger $logger, ResponseInterface $response, RouterInterface $router, GlobalsInterface $globals) { $this->injector = $injector; $this->resource = $resource; $this->response = $response; $this->exceptionHandler = $exceptionHandler; $this->logger = $logger; $this->router = $router; $this->globals = $globals; $resource->attachParamProvider('Provides', new Provides()); }