PHP Class Essence\Crawler

Mostrar archivo Open project: benjamminf/craft-embedded-assets

Protected Properties

Property Type Description
$_Collection Essence\Provider\Collection A collection of providers.
$_Dom Essence\Dom\Document\Factory\Native DOM parser.
$_attributes

Public Methods

Method Description
__construct ( Collection $Collection, Native $Dom ) Constructor.
crawl ( string $html ) : array Extracts embeddable URLs from an HTML source.

Protected Methods

Method Description
_extractUrls ( Document $Document ) : array Extracts URLs from the given DOM document.
_extractUrlsFromtags ( Document $Document, string $tag, string $attribute ) : array Extracts URLs from tag attributes.
_filterUrls ( array $urls ) : array Filters the given URLs to return only the extractable ones.

Method Details

__construct() public method

Constructor.
public __construct ( Collection $Collection, Native $Dom )
$Collection Essence\Provider\Collection Providers collection.
$Dom Essence\Dom\Document\Factory\Native DOM parser.

_extractUrls() protected method

Extracts URLs from the given DOM document.
protected _extractUrls ( Document $Document ) : array
$Document Essence\Dom\Document Document.
return array URLs.

_extractUrlsFromtags() protected method

Extracts URLs from tag attributes.
protected _extractUrlsFromtags ( Document $Document, string $tag, string $attribute ) : array
$Document Essence\Dom\Document Document.
$tag string Tag name.
$attribute string Attribute name.
return array URLs.

_filterUrls() protected method

Filters the given URLs to return only the extractable ones.
protected _filterUrls ( array $urls ) : array
$urls array URLs to filter.
return array Filtered URLs.

crawl() public method

Extracts embeddable URLs from an HTML source.
public crawl ( string $html ) : array
$html string The HTML source to be extracted.
return array An array of extracted URLs.

Property Details

$_Collection protected_oe property

A collection of providers.
protected Collection,Essence\Provider $_Collection
return Essence\Provider\Collection

$_Dom protected_oe property

DOM parser.
protected Native,Essence\Dom\Document\Factory $_Dom
return Essence\Dom\Document\Factory\Native

$_attributes protected_oe property

protected $_attributes