|
1
|
|
|
<?php |
|
2
|
|
|
/******************************************************************************** |
|
3
|
|
|
* Apache License, Version 2.0 * |
|
4
|
|
|
* * |
|
5
|
|
|
* Copyright [2020] [Nurlan Mukhanov <[email protected]>] * |
|
6
|
|
|
* * |
|
7
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); * |
|
8
|
|
|
* you may not use this file except in compliance with the License. * |
|
9
|
|
|
* You may obtain a copy of the License at * |
|
10
|
|
|
* * |
|
11
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 * |
|
12
|
|
|
* * |
|
13
|
|
|
* Unless required by applicable law or agreed to in writing, software * |
|
14
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, * |
|
15
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * |
|
16
|
|
|
* See the License for the specific language governing permissions and * |
|
17
|
|
|
* limitations under the License. * |
|
18
|
|
|
* * |
|
19
|
|
|
********************************************************************************/ |
|
20
|
|
|
|
|
21
|
|
|
declare(strict_types=1); |
|
22
|
|
|
|
|
23
|
|
|
namespace DBD\Entity; |
|
24
|
|
|
|
|
25
|
|
|
use ReflectionProperty; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Class MapperVariables |
|
29
|
|
|
* |
|
30
|
|
|
* @package DBD\Entity |
|
31
|
|
|
*/ |
|
32
|
|
|
final class MapperVariables |
|
33
|
|
|
{ |
|
34
|
|
|
public $columns; |
|
35
|
|
|
public $complex; |
|
36
|
|
|
public $constraints; |
|
37
|
|
|
public $embedded; |
|
38
|
|
|
//public $otherColumns; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* MapperVariables constructor. |
|
42
|
|
|
* |
|
43
|
|
|
* @param $columns |
|
44
|
|
|
* @param $constraints |
|
45
|
|
|
* @param $embedded |
|
46
|
|
|
* @param $complex |
|
47
|
|
|
*/ |
|
48
|
|
|
public function __construct($columns, $constraints, $embedded, $complex) // $otherColumns, |
|
49
|
|
|
{ |
|
50
|
|
|
$this->columns = $this->filter($columns); |
|
51
|
|
|
$this->constraints = $this->filter($constraints); |
|
52
|
|
|
$this->embedded = $this->filter($embedded); |
|
53
|
|
|
$this->complex = $this->filter($complex); |
|
54
|
|
|
//$this->otherColumns = $this->filter($otherColumns); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @param ReflectionProperty[] $vars |
|
59
|
|
|
* |
|
60
|
|
|
* @return array |
|
61
|
|
|
*/ |
|
62
|
|
|
private function filter(array $vars): array |
|
63
|
|
|
{ |
|
64
|
|
|
$list = []; |
|
65
|
|
|
foreach ($vars as $varName => $varValue) { |
|
66
|
|
|
$list[] = $varName; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
return $list; |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|