/** * Adds a middleware to the middleware list. The higher priority value, the earlier a middleware * will be triggered in the chain (defaults to 0). * * @param MiddlewareInterface $middleware * @param int $priority */ public function addMiddleware(MiddlewareInterface $middleware, $priority = 0) { if (!$this->middlewares->containsKey($priority)) { $this->middlewares->set($priority, new ArrayList()); } /** @var ArrayList $middlewares */ $middlewares = $this->middlewares->get($priority); if ($middlewares->findOne(Criteria::eq($middleware)) === null) { $middlewares->add($middleware); } }
/** * @return int */ public function count() { return $this->store->count(); }