1 | <?php |
||
26 | * not to write or read it from anywhere |
||
27 | * |
||
28 | */ |
||
29 | abstract class AbstractAnonymizer |
||
30 | { |
||
31 | /** |
||
32 | * Constant to define the type of action for that table |
||
33 | */ |
||
34 | const TRUNCATE_TABLE = 1; |
||
35 | |||
36 | /** |
||
37 | * Constant to define the type of action for that table |
||
38 | */ |
||
39 | const UPDATE_TABLE = 2; |
||
40 | |||
41 | /** |
||
42 | * Contain the configuration object |
||
43 | * |
||
44 | * @var Reader |
||
45 | */ |
||
46 | protected $configuration; |
||
47 | |||
48 | /** |
||
49 | * Configuration of entities |
||
50 | * |
||
51 | * @var array |
||
52 | */ |
||
53 | protected $configEntites = []; |
||
54 | |||
55 | /** |
||
56 | * Current table (entity) to process |
||
57 | * @var string |
||
58 | */ |
||
59 | protected $entity; |
||
60 | |||
61 | /** |
||
62 | * Current table (entity) Columns |
||
63 | * @var array |
||
64 | */ |
||
65 | protected $entityCols; |
||
66 | |||
67 | |||
68 | /** |
||
69 | * Process the entity according to the anonymizer type |
||
70 | * |
||
71 | * @param string $entity |
||
72 | * @param callable|null $callback |
||
73 | * @param bool $pretend |
||
74 | * @param bool $returnResult |
||
|
|||
75 | */ |
||
76 | abstract public function processEntity( |
||
82 | |||
83 | |||
84 | /** |
||
85 | * Set the configuration |
||
86 | * |
||
87 | * @param Reader $configuration |
||
88 | */ |
||
89 | 15 | public function setConfiguration(Reader $configuration) |
|
94 | |||
95 | |||
96 | /** |
||
97 | * Evaluate, from the configuration if I have to update or Truncate the table |
||
98 | * |
||
99 | * @return int |
||
100 | */ |
||
101 | 12 | protected function whatToDoWithEntity(): int |
|
118 | |||
119 | |||
120 | /** |
||
121 | * Returns the 'delete_where' parameter for an entity in config (or empty) |
||
122 | * |
||
123 | * @return string |
||
124 | */ |
||
125 | 4 | public function getWhereConditionInConfig(): string |
|
135 | |||
136 | |||
137 | /** |
||
138 | * Generate fake data for an entity and return it as an Array |
||
139 | * |
||
140 | * @return array |
||
141 | */ |
||
142 | 7 | protected function generateFakeData(): array |
|
165 | |||
166 | |||
167 | /** |
||
168 | * Make sure that entity is defined in the configuration |
||
186 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.
Consider the following example. The parameter
$ireland
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was changed, but the annotation was not.