-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMappingContext.php
More file actions
36 lines (31 loc) · 971 Bytes
/
Copy pathMappingContext.php
File metadata and controls
36 lines (31 loc) · 971 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
declare(strict_types=1);
namespace TinyBlocks\Mapper;
/**
* Recursion and naming handed to a {@see Mapping} during a mapping operation.
*/
interface MappingContext
{
/**
* Maps the source into an instance of the given type, applying the full pipeline.
*
* @template T of object
* @param class-string<T> $type The nested type to build.
* @param mixed $source The source value for the nested type.
* @return T The built instance.
*/
public function read(string $type, mixed $source): object;
/**
* Serializes a value of any type through the active pipeline.
*
* @param mixed $value The value to serialize, scalar or object.
* @return mixed The portable representation.
*/
public function write(mixed $value): mixed;
/**
* Returns the active naming strategy.
*
* @return NamingStrategy The strategy in effect.
*/
public function naming(): NamingStrategy;
}