1 | <?php |
||
13 | class DebugTransformDecorator extends BaseTransformer |
||
14 | { |
||
15 | |||
16 | /** |
||
17 | * @var TransformerInterface |
||
18 | */ |
||
19 | private $transformer; |
||
20 | |||
21 | /** |
||
22 | * Supported index names returned by the Gerrie API. |
||
23 | * |
||
24 | * @var array |
||
25 | */ |
||
26 | protected $supportedKeys = []; |
||
27 | |||
28 | /** |
||
29 | * @param TransformerInterface $transformer |
||
30 | */ |
||
31 | public function __construct(TransformerInterface $transformer) |
||
35 | |||
36 | /** |
||
37 | * Set the data to transform |
||
38 | * |
||
39 | * @param array $data |
||
40 | * @return void |
||
41 | */ |
||
42 | public function setData(array $data) |
||
46 | |||
47 | /** |
||
48 | * Returns the data to transform |
||
49 | * |
||
50 | * @return array |
||
51 | */ |
||
52 | public function getData() |
||
56 | |||
57 | /** |
||
58 | * Checks if the current data transformer is responsible to transform the given data. |
||
59 | * |
||
60 | * @return boolean |
||
61 | */ |
||
62 | public function isResponsible() |
||
66 | |||
67 | /** |
||
68 | * Transforms the data into one unique format |
||
69 | * |
||
70 | * @return array |
||
71 | */ |
||
72 | public function transform() |
||
82 | |||
83 | /** |
||
84 | * Unsets an amount of keys in given $data |
||
85 | * |
||
86 | * @param array $data Data array where the keys will be unset |
||
87 | * @param array $keyList List of keys which will be unset |
||
88 | * @return array |
||
89 | */ |
||
90 | private function unsetKeys(array $data, array $keyList) |
||
100 | |||
101 | /** |
||
102 | * Method to check if all data were imported. |
||
103 | * Normally, this export script unsets the exported value after proceeding. |
||
104 | * |
||
105 | * If there are values left in the array, there could be |
||
106 | * a) a bug, because the value is not unsetted |
||
107 | * b) a change in the Gerrit server API |
||
108 | * c) a bug, because not all values are exported / proceeded |
||
109 | * |
||
110 | * This methods help to detect this :) |
||
111 | * |
||
112 | * @param array $data Data to inspect |
||
113 | * @param TransformerInterface $transformer The transformer class |
||
114 | * @throws \Exception |
||
115 | */ |
||
116 | private function checkIfAllValuesWereProceeded(array $data, TransformerInterface $transformer) |
||
125 | } |