Ubiquity  2.4.10
php rapid development framework
TransformersManager Class Reference

Transform objects after loading. More...

Static Public Member Functions

static start ()
 Load all transformers. More...
 
static startProd (?string $op='transform')
 Start the manager for production. More...
 
static registerClass (string $transformer, string $classname)
 Register a new transformer class. More...
 
static registerClassAndSave (string $transformer, string $classname)
 Register and save in cache a new Transformer. More...
 
static registerClasses (array $transformersAndClasses)
 Register an associative array of transformers based on ['name'=>'transformerClass']. More...
 
static registerClassesAndSave (array $transformersAndClasses)
 Register and save an associative array of transformers based on ['name'=>'transformerClass']. More...
 
static getTransformerClass (string $transformer)
 Return the class from a transformer name. More...
 
static transform (object $instance, string $member, ?string $transform='transform')
 Transform a member of an instance. More...
 
static applyTransformer (object $instance, string $member, $value, ?string $transform='transform')
 Apply a transformer using a member transformer(s) on a value. More...
 
static transformInstance (object $instance, $transform='transform')
 Transform all the members of a model instance. More...
 
static store ()
 Store the loaded transformers in cache. More...
 

Data Fields

const TRANSFORMER_TYPES = [ 'reverse' => TransformerInterface::class
 

Static Private Attributes

static $transformers = [ 'md5' => Md5::class
 
static static $key = 'contents/transformers'
 

Detailed Description

Transform objects after loading.

Ubiquity$TransformersManager This class is part of Ubiquity

Author
jcheron myadd.nosp@m.ress.nosp@m.mail@.nosp@m.gmai.nosp@m.l.com
Version
1.0.4

Definition at line 27 of file TransformersManager.php.

Member Function Documentation

◆ applyTransformer()

static applyTransformer ( object  $instance,
string  $member,
  $value,
?string  $transform = 'transform' 
)
static

Apply a transformer using a member transformer(s) on a value.

Parameters
object$instance
string$member
mixed$value
string$transform
Returns
mixed

Definition at line 147 of file TransformersManager.php.

◆ getTransformerClass()

static getTransformerClass ( string  $transformer)
static

Return the class from a transformer name.

Parameters
string$transformer
Returns
?string

Definition at line 115 of file TransformersManager.php.

◆ registerClass()

static registerClass ( string  $transformer,
string  $classname 
)
static

Register a new transformer class.

Do not used at runtime !

Parameters
string$transformer
string$classname

Definition at line 66 of file TransformersManager.php.

◆ registerClassAndSave()

static registerClassAndSave ( string  $transformer,
string  $classname 
)
static

Register and save in cache a new Transformer.

Do not used at runtime !

Parameters
string$transformer
string$classname

Definition at line 77 of file TransformersManager.php.

◆ registerClasses()

static registerClasses ( array  $transformersAndClasses)
static

Register an associative array of transformers based on ['name'=>'transformerClass'].

Do not used at runtime !

Parameters
array$transformersAndClasses

Definition at line 89 of file TransformersManager.php.

◆ registerClassesAndSave()

static registerClassesAndSave ( array  $transformersAndClasses)
static

Register and save an associative array of transformers based on ['name'=>'transformerClass'].

Do not used at runtime !

Parameters
array$transformersAndClasses

Definition at line 101 of file TransformersManager.php.

◆ start()

static start ( )
static

Load all transformers.

Do not use at runtime !

Definition at line 40 of file TransformersManager.php.

◆ startProd()

static startProd ( ?string  $op = 'transform')
static

Start the manager for production.

Parameters
?string$op

Definition at line 54 of file TransformersManager.php.

◆ store()

static store ( )
static

Store the loaded transformers in cache.

Definition at line 183 of file TransformersManager.php.

◆ transform()

static transform ( object  $instance,
string  $member,
?string  $transform = 'transform' 
)
static

Transform a member of an instance.

Parameters
object$instance
string$member
string$transform
Returns
?mixed

Definition at line 130 of file TransformersManager.php.

◆ transformInstance()

static transformInstance ( object  $instance,
  $transform = 'transform' 
)
static

Transform all the members of a model instance.

Parameters
object$instance
string$transform

Definition at line 163 of file TransformersManager.php.

Field Documentation

◆ $key

static $key = 'contents/transformers'
staticprivate

Definition at line 34 of file TransformersManager.php.

◆ $transformers

$transformers = [ 'md5' => Md5::class
staticprivate

Definition at line 33 of file TransformersManager.php.

◆ TRANSFORMER_TYPES

const TRANSFORMER_TYPES = [ 'reverse' => TransformerInterface::class

Definition at line 28 of file TransformersManager.php.


The documentation for this class was generated from the following file: