BumbleDocGen / Technical description of the project / Class map / ValueToClassTransformer
ValueToClassTransformer class:
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
- # __construct | source code
public function __construct(\DI\Container $diContainer);
Parameters:
Name | Type | Description |
---|---|---|
$diContainer | \DI\Container | - |
- # canTransform | source code
public function canTransform(mixed $value): bool;
Parameters:
Name | Type | Description |
---|---|---|
$value | mixed | - |
Return value: bool
- # transform | source code
public function transform(mixed $value): object|null;
Parameters:
Name | Type | Description |
---|---|---|
$value | mixed | - |
Throws: