PHP Class Essence\Provider\MetaTags

Inheritance: extends Essence\Provider
Show file Open project: essence/essence Class Usage Examples

Protected Properties

Property Type Description
$_Dom Essence\Dom\Document\Factory\Native DOM parser.
$_Http Essence\Http\Client HTTP client.
$_metaAttribute string Meta naming attribute.
$_metaPattern string A regex to filter meta tags.

Public Methods

Method Description
__construct ( Essence\Http\Client $Http, Native $Dom ) Constructor.
setMetaAttribute ( $attribute ) Sets the meta attribute
setMetaPattern ( string $pattern ) Sets the filter pattern.

Protected Methods

Method Description
_extract ( $url, array $options ) {@inheritDoc}
_extractMetas ( string $html ) : array Extracts meta tags from the given HTML source.
_media ( array $metas ) : Media Builds a media from the given meta tags.

Method Details

__construct() public method

Constructor.
public __construct ( Essence\Http\Client $Http, Native $Dom )
$Http Essence\Http\Client HTTP client.
$Dom Essence\Dom\Document\Factory\Native DOM parser.

_extract() protected method

{@inheritDoc}
protected _extract ( $url, array $options )
$options array

_extractMetas() protected method

Extracts meta tags from the given HTML source.
protected _extractMetas ( string $html ) : array
$html string HTML.
return array Meta tags.

_media() protected method

Builds a media from the given meta tags.
protected _media ( array $metas ) : Media
$metas array Meta tags.
return Essence\Media Media.

setMetaAttribute() public method

Sets the meta attribute
public setMetaAttribute ( $attribute )
$attribute

setMetaPattern() public method

Sets the filter pattern.
public setMetaPattern ( string $pattern )
$pattern string Pattern.

Property Details

$_Dom protected property

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

$_Http protected property

HTTP client.
protected Client,Essence\Http $_Http
return Essence\Http\Client

$_metaAttribute protected property

Meta naming attribute.
protected string $_metaAttribute
return string

$_metaPattern protected property

A regex to filter meta tags.
protected string $_metaPattern
return string