1 | <?php |
||
9 | class Mapper |
||
10 | { |
||
11 | /** @var Structure */ |
||
12 | private $structure; |
||
13 | |||
14 | /** @var array */ |
||
15 | private $repositories = []; |
||
16 | |||
17 | /** |
||
18 | * @param Structure $structure |
||
19 | */ |
||
20 | public function __construct(Structure $structure) |
||
24 | |||
25 | /** |
||
26 | * Map classes and scopes by repository |
||
27 | * @param Repository $repository |
||
28 | * @param string|null $activeRowClass |
||
29 | * @param string|null $selectionClass |
||
30 | * @return Mapper |
||
31 | */ |
||
32 | public function mapRepository(Repository $repository, string $activeRowClass = null, string $selectionClass = null): Mapper |
||
47 | |||
48 | /** |
||
49 | * Map classes only by table name |
||
50 | * @param string $tableName |
||
51 | * @param string|null $activeRowClass |
||
52 | * @param string|null $selectionClass |
||
53 | * @return Mapper |
||
54 | */ |
||
55 | public function mapTableName(string $tableName, string $activeRowClass = null, string $selectionClass = null): Mapper |
||
67 | |||
68 | /** |
||
69 | * @param string $class |
||
70 | * @return null|Repository |
||
71 | */ |
||
72 | public function getRepository(string $class): ?Repository |
||
76 | } |
||
77 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: