Essence\Provider\Collection::hasProvider PHP Method

hasProvider() public method

Tells if a provider can handle the given url.
public hasProvider ( string $url ) : boolean
$url string An url which may be extracted.
return boolean The url provider if any, otherwise null.
    public function hasProvider($url)
    {
        $filters = $this->_Container->get('filters');
        foreach ($filters as $filter) {
            if ($this->_matches($filter, $url)) {
                return true;
            }
        }
        return false;
    }

Usage Example

 /**
  *	Filters the given URLs to return only the extractable ones.
  *
  *	@param array $urls URLs to filter.
  *	@return array Filtered URLs.
  */
 protected function _filterUrls(array $urls)
 {
     $urls = array_filter($urls, function ($url) {
         return $this->_Collection->hasProvider($url);
     });
     return array_values($urls);
 }