PHP Class Embera\Formatter

It outputs the oembed data as a custom string.
Datei anzeigen Open project: mpratt/embera

Protected Properties

Property 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

Public Methods

Method 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.

Protected Methods

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

Method Details

__call() public method

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
return mixed

__construct() public method

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

getErrors() public method

Returns an array with all the errors
public getErrors ( ) : array
return array

getLastError() public method

Gets the last error found
public getLastError ( ) : string
return string

hasErrors() public method

Checks if there were errors
public hasErrors ( ) : boolean
return boolean

replace() protected method

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

setTemplate() public method

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
return string

transform() public method

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
return 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