\BrickrougeHelpers

Brickrouge helpers.

The following helpers are patchable:

  • \Brickrouge\format()
  • \Brickrouge\format_size()
  • \Brickrouge\get_accessible_file()
  • \Brickrouge\get_document()
  • \Brickrouge\normalize()
  • \Brickrouge\render_exception()
  • \Brickrouge\t()

Summary

Methods
Properties
Constants
__callStatic()
patch()
format()
format_size()
get_accessible_file()
get_document()
normalize()
render_exception()
t()
No public properties found
No constants found
default_format()
default_format_size()
default_normalize()
default_t()
default_get_document()
default_render_exception()
default_get_accessible_file()
No protected properties found
N/A
No private methods found
$mapping
$document
N/A

Properties

$mapping

$mapping : 

Type

$document

$document : 

Type

Methods

__callStatic()

__callStatic(string  $name, array  $arguments) : mixed

Calls the callback of a patchable function.

Parameters

string $name

Name of the function.

array $arguments

Arguments.

Returns

mixed

patch()

patch(string  $name, callable  $callback) 

Patches a patchable function.

Parameters

string $name

Name of the function.

callable $callback

Callback.

Throws

\RuntimeException

is attempt to patch an undefined function.

format()

format(string  $str, array  $args=[]) : string

Parameters

string $str
array $args=[]

Returns

string

format_size()

format_size(\number  $size) : string

Parameters

\number $size

Returns

string

get_accessible_file()

get_accessible_file(string  $path) : string

Parameters

string $path

Returns

string

get_document()

get_document() : \Brickrouge\Document

Returns

\Brickrouge\Document

normalize()

normalize(string  $str) : string

Parameters

string $str

Returns

string

render_exception()

render_exception(\Exception  $exception) : string

Parameters

\Exception $exception

Returns

string

t()

t(string  $str, array  $args=[], array  $options=[]) : string

Parameters

string $str
array $args=[]
array $options=[]

Returns

string

default_format()

default_format(string  $str, array  $args = array()) : string

This method is the fallback for the {@link format()} function.

Parameters

string $str
array $args

Returns

string

default_format_size()

default_format_size(integer  $size) : string

This method is the fallback for the {@link format_size()} function.

Parameters

integer $size

Returns

string

default_normalize()

default_normalize(string  $str, string  $separator = '-', string  $charset = CHARSET) : string

This method is the fallback for the {@link normalize()} function.

Parameters

string $str
string $separator
string $charset

Returns

string

default_t()

default_t(string  $str, array  $args = array()) : string

This method is the fallback for the {@link t()} function.

We usually rely on the ICanBoogie framework I18n features to translate our string, if it is not available we simply format the string using the \Brickrouge\format() function.

Parameters

string $str
array $args

Returns

string

default_get_document()

default_get_document() 

This method is the fallback for the {@link get_document()} function.

default_render_exception()

default_render_exception(\Exception  $exception) : string

This method is the fallback for the {@link render_exception()} function.

Parameters

\Exception $exception

Returns

string

default_get_accessible_file()

default_get_accessible_file(string  $path) : string

This method is the fallback for the {@link get_accessible_file()} function.

Parameters

string $path

Absolute path to the web inaccessible file.

Throws

\Exception

if the replacement file could not be created.

Returns

string —

The pathname of the replacement.