PHP Class Embera\Formatter

It outputs the oembed data as a custom string.
Afficher le fichier Open project: mpratt/embera

Protected Properties

Свойство Type Description
$allowOffline Wether or not to allow offline responses
$embera Instance of \Embera\Embera
$errors Fetched errors
$template The template with placeholders to be replaced with the data from an ombed response

Méthodes publiques

Méthode Description
__call ( string $method, array $args ) : mixed Truly decorate the embera object. With this method Im preserving compatability with the API of the decorated object.
__construct ( Embera $embera, boolean $allowOffline = false ) : void Constructor
getErrors ( ) : array Returns an array with all the errors
getLastError ( ) : string Gets the last error found
hasErrors ( ) : boolean Checks if there were errors
setTemplate ( string $template, string | array $body = null ) : string Sets a template with placeholders, that should be replaced by the data from an oembed response.
transform ( string | array $body = null ) : string This method transforms an array or a string with urls into another string using a specified template.

Méthodes protégées

Méthode Description
replace ( array $data, string $template, string $prefix = null ) : string Replaces the given $data inside the $template

Method Details

__call() public méthode

Truly decorate the embera object. With this method Im preserving compatability with the API of the decorated object.
public __call ( string $method, array $args ) : mixed
$method string
$args array
Résultat mixed

__construct() public méthode

Constructor
public __construct ( Embera $embera, boolean $allowOffline = false ) : void
$embera Embera Instance of \Embera\Embera
$allowOffline boolean Wether or not to allow offline embera
Résultat void

getErrors() public méthode

Returns an array with all the errors
public getErrors ( ) : array
Résultat array

getLastError() public méthode

Gets the last error found
public getLastError ( ) : string
Résultat string

hasErrors() public méthode

Checks if there were errors
public hasErrors ( ) : boolean
Résultat boolean

replace() protected méthode

Replaces the given $data inside the $template
protected replace ( array $data, string $template, string $prefix = null ) : string
$data array
$template string
$prefix string
Résultat string

setTemplate() public méthode

Sets a template with placeholders, that should be replaced by the data from an oembed response.
public setTemplate ( string $template, string | array $body = null ) : string
$template string
$body string | array An array or string with Urls
Résultat string

transform() public méthode

This method transforms an array or a string with urls into another string using a specified template.
public transform ( string | array $body = null ) : string
$body string | array An array or string with Urls
Résultat string

Property Details

$allowOffline protected_oe property

Wether or not to allow offline responses
protected $allowOffline

$embera protected_oe property

Instance of \Embera\Embera
protected $embera

$errors protected_oe property

Fetched errors
protected $errors

$template protected_oe property

The template with placeholders to be replaced with the data from an ombed response
protected $template