PHP Class Essence\Provider\OEmbed

This kind of provider extracts embed informations through the OEmbed protocol.
Inheritance: extends Essence\Provider
Afficher le fichier Open project: benjamminf/craft-embedded-assets Class Usage Examples

Protected Properties

Свойство Type Description
$_Dom Essence\Dom\Document\Factory\Native DOM parser.
$_Http Essence\Http\Client HTTP client.
$_endpoint string The OEmbed endpoint.
$_format string The expected response format.

Méthodes publiques

Méthode Description
__construct ( Essence\Http\Client $Http, Native $Dom ) Constructor.
setEndpoint ( string $endpoint ) Sets the endpoint.
setFormat ( string $format ) Sets the response format.

Méthodes protégées

Méthode Description
_buildConfig ( string $url ) : Config Builds an oEmbed configuration from settings.
_config ( string $url, array $options ) : Config Builds or extracts an oEmbed config.
_extract ( $url, array $options ) {@inheritDoc}
_extractConfig ( string $html ) : array Extracts an oEmbed configuration from the given page.
_extractFormat ( Tag $Link ) : Tag Extracts an oEmbed response format from a link tag.
_parse ( string $response, string $format ) : array Parses the given response depending on its format.

Method Details

__construct() public méthode

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

_buildConfig() protected méthode

Builds an oEmbed configuration from settings.
protected _buildConfig ( string $url ) : Config
$url string URL to extract.
Résultat Essence\Provider\OEmbed\Config Configuration.

_config() protected méthode

Builds or extracts an oEmbed config.
protected _config ( string $url, array $options ) : Config
$url string URL.
$options array Options.
Résultat Essence\Provider\OEmbed\Config Configuration.

_extract() protected méthode

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

_extractConfig() protected méthode

Extracts an oEmbed configuration from the given page.
protected _extractConfig ( string $html ) : array
$html string HTML page.
Résultat array Configuration.

_extractFormat() protected méthode

Extracts an oEmbed response format from a link tag.
protected _extractFormat ( Tag $Link ) : Tag
$Link Essence\Dom\Tag Link tag.
Résultat Essence\Dom\Tag string|null Format.

_parse() protected méthode

Parses the given response depending on its format.
protected _parse ( string $response, string $format ) : array
$response string Response.
$format string Format.
Résultat array Data.

setEndpoint() public méthode

Sets the endpoint.
public setEndpoint ( string $endpoint )
$endpoint string Endpoint.

setFormat() public méthode

Sets the response format.
public setFormat ( string $format )
$format string Format.

Property Details

$_Dom protected_oe property

DOM parser.
protected Native,Essence\Dom\Document\Factory $_Dom
Résultat Essence\Dom\Document\Factory\Native

$_Http protected_oe property

HTTP client.
protected Client,Essence\Http $_Http
Résultat Essence\Http\Client

$_endpoint protected_oe property

The OEmbed endpoint.
protected string $_endpoint
Résultat string

$_format protected_oe property

The expected response format.
protected string $_format
Résultat string