Skip to content

Latest commit

 

History

History
204 lines (140 loc) · 4.24 KB

ValueToClassTransformer.md

File metadata and controls

204 lines (140 loc) · 4.24 KB

BumbleDocGen / Technical description of the project / Class map / ValueToClassTransformer


namespace BumbleDocGen\Core\Configuration\ValueTransformer;

final class ValueToClassTransformer implements \BumbleDocGen\Core\Configuration\ValueTransformer\ValueTransformerInterface
Standard text-to-class transformer

Examples of using:

# The list of class names will be converted to an array of objects
someKey:
    - class: \Namespace\ClassName
    - class: \Namespace\ClassName2
# One class in configuration will be converted to one object
someKey:
    class: \Namespace\ClassName
# One class in configuration will be converted to one object. The constructor takes arguments to be passed (not via DI)
someKey:
    class: \Namespace\ClassName
    arguments:
        - arg1: value1
        - arg2: value2

Initialization methods:

  1. __construct

Methods:

  1. canTransform
  2. transform

Method details:

public function __construct(\DI\Container $diContainer);

Parameters:

Name Type Description
$diContainer \DI\Container -

public function canTransform(mixed $value): bool;

Parameters:

Name Type Description
$value mixed -

Return value: bool


public function transform(mixed $value): object|null;

Parameters:

Name Type Description
$value mixed -

Return value: object | null

Throws: