/** * Returns a function used to replace URLs by informations. * * @see replace() * @param callable $template Templating callback. * @param array $options Custom options to be interpreted by a provider. * @return \Closure Function. */ protected function _replaceFunction($template, array $options) { return function ($matches) use($template, $options) { $url = $matches[0]; $Media = $this->_Extractor->extract($url, $options); return $Media ? $template($Media) : $url; }; }