/** * {@inheritdoc} */ public function __construct(Request $request, array $config = null) { $this->request = $request; if (isset($config['adapter']['config'])) { $this->config = array_replace($this->config, $config['adapter']['config']); } if (isset($config['providers'])) { $this->providersConfig = $config['providers']; } if (isset($config['image']['class'])) { $this->imageClass = $config['image']['class']; } if (isset($config['image']['config'])) { $this->imageConfig = $config['image']['config']; } $this->run(); //if the canonical url is different, repeat the proccess $canonical = $this->getUrl(); if ($request->getUrl() !== $canonical) { $request = $request->withUrl($canonical); if ($request->isValid()) { $this->request = $request; $this->run(); } } }
/** * {@inheritdoc} */ public function getUrl() { return Utils::getFirstValue(Utils::getData($this->providers, 'url', $this->request)) ?: $this->request->getUrl(); }