x Sorry, these patches are not available anymore due to data migration. Please run a fresh inspection.
Completed
Push — master ( 12ec90...823b87 )
by Daniel
02:20
created
source/Compare.php 1 patch
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -75,71 +75,71 @@  discard block
 block discarded – undo
75 75
 
76 76
     private function displayTableFromMultiLevelArray($inArray)
77 77
     {
78
-        if ((!is_array($inArray['source'])) || (!is_array($inArray['destination']))) {
78
+        if ((!is_array($inArray[ 'source' ])) || (!is_array($inArray[ 'destination' ]))) {
79 79
             return '';
80 80
         }
81
-        $firstRow     = $this->mergeArraysIntoFirstSecond($inArray['source'], $inArray['destination'], [
81
+        $firstRow = $this->mergeArraysIntoFirstSecond($inArray[ 'source' ], $inArray[ 'destination' ], [
82 82
             'first',
83 83
             'second',
84 84
         ]);
85
-        $secondRow    = $this->mergeArraysIntoFirstSecond($inArray['destination'], $inArray['source'], [
85
+        $secondRow = $this->mergeArraysIntoFirstSecond($inArray[ 'destination' ], $inArray[ 'source' ], [
86 86
             'second',
87 87
             'first',
88 88
         ]);
89 89
         $row          = array_merge($firstRow, $secondRow);
90 90
         ksort($row);
91
-        $urlArguments = '?Label=' . $inArray['SuperGlobals']->get('Label');
92
-        $sString[]    = '<table style="width:100%">'
91
+        $urlArguments = '?Label=' . $inArray[ 'SuperGlobals' ]->get('Label');
92
+        $sString[ ]    = '<table style="width:100%">'
93 93
                 . '<thead><tr>'
94 94
                 . '<th>Identifier</th>'
95
-                . '<th><a href="' . $this->config['Servers'][$inArray['SuperGlobals']->get('localConfig')]['url']
95
+                . '<th><a href="' . $this->config[ 'Servers' ][ $inArray[ 'SuperGlobals' ]->get('localConfig') ][ 'url' ]
96 96
                 . $urlArguments . '" target="_blank">'
97
-                . $this->config['Servers'][$inArray['SuperGlobals']->get('localConfig')]['name'] . '</a></th>'
98
-                . '<th><a href="' . $this->config['Servers'][$inArray['SuperGlobals']->get('serverConfig')]['url']
97
+                . $this->config[ 'Servers' ][ $inArray[ 'SuperGlobals' ]->get('localConfig') ][ 'name' ] . '</a></th>'
98
+                . '<th><a href="' . $this->config[ 'Servers' ][ $inArray[ 'SuperGlobals' ]->get('serverConfig') ][ 'url' ]
99 99
                 . $urlArguments . '" target="_blank">'
100
-                . $this->config['Servers'][$inArray['SuperGlobals']->get('serverConfig')]['name'] . '</a></th>'
100
+                . $this->config[ 'Servers' ][ $inArray[ 'SuperGlobals' ]->get('serverConfig') ][ 'name' ] . '</a></th>'
101 101
                 . '</tr></thead>'
102 102
                 . '<tbody>';
103
-        if ($inArray['SuperGlobals']->get('displayOnlyDifferent') == '1') {
103
+        if ($inArray[ 'SuperGlobals' ]->get('displayOnlyDifferent') == '1') {
104 104
             $displayOnlyDifferent = true;
105 105
         } else {
106 106
             $displayOnlyDifferent = false;
107 107
         }
108 108
         foreach ($row as $key => $value) {
109 109
             $rowString = '<tr><td style="width:20%;">' . $key . '</td><td style="width:40%;">'
110
-                    . str_replace(',', ', ', $value['first']) . '</td><td style="width:40%;">'
111
-                    . str_replace(',', ', ', $value['second']) . '</td></tr>';
110
+                    . str_replace(',', ', ', $value[ 'first' ]) . '</td><td style="width:40%;">'
111
+                    . str_replace(',', ', ', $value[ 'second' ]) . '</td></tr>';
112 112
             if ($displayOnlyDifferent) {
113
-                if ($value['first'] != $value['second']) {
114
-                    $sString[] = $rowString;
113
+                if ($value[ 'first' ] != $value[ 'second' ]) {
114
+                    $sString[ ] = $rowString;
115 115
                 }
116 116
             } else {
117
-                $sString[] = $rowString;
117
+                $sString[ ] = $rowString;
118 118
             }
119 119
         }
120
-        $sString[] = '</tbody></table>';
120
+        $sString[ ] = '</tbody></table>';
121 121
         return implode('', $sString);
122 122
     }
123 123
 
124 124
     private function getConfiguration()
125 125
     {
126 126
         $strdConfig = $this->configuredDeployedInformators();
127
-        foreach ($strdConfig['informators'] as $key => $value) {
128
-            $this->config['Servers'][] = [
127
+        foreach ($strdConfig[ 'informators' ] as $key => $value) {
128
+            $this->config[ 'Servers' ][ ] = [
129 129
                 'name' => $key,
130 130
                 'url'  => $value,
131 131
             ];
132 132
         }
133
-        $haystack                                         = array_keys($strdConfig['informators']);
134
-        $this->config['Defaults']['Label']                = $strdConfig['default']['label'];
135
-        $this->config['Defaults']['localConfig']          = array_search($strdConfig['default']['source'], $haystack);
136
-        $this->config['Defaults']['serverConfig']         = array_search($strdConfig['default']['target'], $haystack);
137
-        $this->config['Defaults']['displayOnlyDifferent'] = $strdConfig['default']['typeOfResults'];
133
+        $haystack                                         = array_keys($strdConfig[ 'informators' ]);
134
+        $this->config[ 'Defaults' ][ 'Label' ]                = $strdConfig[ 'default' ][ 'label' ];
135
+        $this->config[ 'Defaults' ][ 'localConfig' ]          = array_search($strdConfig[ 'default' ][ 'source' ], $haystack);
136
+        $this->config[ 'Defaults' ][ 'serverConfig' ]         = array_search($strdConfig[ 'default' ][ 'target' ], $haystack);
137
+        $this->config[ 'Defaults' ][ 'displayOnlyDifferent' ] = $strdConfig[ 'default' ][ 'typeOfResults' ];
138 138
     }
139 139
 
140
-    private function mergeArraysIntoFirstSecond($firstArray, $secondArray, $pSequence = ['first', 'second'])
140
+    private function mergeArraysIntoFirstSecond($firstArray, $secondArray, $pSequence = [ 'first', 'second' ])
141 141
     {
142
-        $row = [];
142
+        $row = [ ];
143 143
         foreach ($firstArray as $key => $value) {
144 144
             if (is_array($value)) {
145 145
                 foreach ($value as $key2 => $value2) {
@@ -148,39 +148,39 @@  discard block
 block discarded – undo
148 148
                             if (is_array($value3)) {
149 149
                                 foreach ($value3 as $key4 => $value4) {
150 150
                                     $keyCrt                      = $key . '_' . $key2 . '__' . $key3 . '__' . $key4;
151
-                                    $row[$keyCrt][$pSequence[0]] = $value4;
152
-                                    if (isset($secondArray[$key][$key2][$key3][$key4])) {
153
-                                        $row[$keyCrt][$pSequence[1]] = $secondArray[$key][$key2][$key3][$key4];
151
+                                    $row[ $keyCrt ][ $pSequence[ 0 ] ] = $value4;
152
+                                    if (isset($secondArray[ $key ][ $key2 ][ $key3 ][ $key4 ])) {
153
+                                        $row[ $keyCrt ][ $pSequence[ 1 ] ] = $secondArray[ $key ][ $key2 ][ $key3 ][ $key4 ];
154 154
                                     } else {
155
-                                        $row[$keyCrt][$pSequence[1]] = '';
155
+                                        $row[ $keyCrt ][ $pSequence[ 1 ] ] = '';
156 156
                                     }
157 157
                                 }
158 158
                             } else {
159 159
                                 $keyCrt                      = $key . '_' . $key2 . '__' . $key3;
160
-                                $row[$keyCrt][$pSequence[0]] = $value3;
161
-                                if (isset($secondArray[$key][$key2][$key3])) {
162
-                                    $row[$keyCrt][$pSequence[1]] = $secondArray[$key][$key2][$key3];
160
+                                $row[ $keyCrt ][ $pSequence[ 0 ] ] = $value3;
161
+                                if (isset($secondArray[ $key ][ $key2 ][ $key3 ])) {
162
+                                    $row[ $keyCrt ][ $pSequence[ 1 ] ] = $secondArray[ $key ][ $key2 ][ $key3 ];
163 163
                                 } else {
164
-                                    $row[$keyCrt][$pSequence[1]] = '';
164
+                                    $row[ $keyCrt ][ $pSequence[ 1 ] ] = '';
165 165
                                 }
166 166
                             }
167 167
                         }
168 168
                     } else {
169 169
                         $keyCrt                      = $key . '_' . $key2;
170
-                        $row[$keyCrt][$pSequence[0]] = $value2;
171
-                        if (isset($secondArray[$key][$key2])) {
172
-                            $row[$keyCrt][$pSequence[1]] = $secondArray[$key][$key2];
170
+                        $row[ $keyCrt ][ $pSequence[ 0 ] ] = $value2;
171
+                        if (isset($secondArray[ $key ][ $key2 ])) {
172
+                            $row[ $keyCrt ][ $pSequence[ 1 ] ] = $secondArray[ $key ][ $key2 ];
173 173
                         } else {
174
-                            $row[$keyCrt][$pSequence[1]] = '';
174
+                            $row[ $keyCrt ][ $pSequence[ 1 ] ] = '';
175 175
                         }
176 176
                     }
177 177
                 }
178 178
             } else {
179
-                $row[$key][$pSequence[0]] = $value;
180
-                if (isset($secondArray[$key])) {
181
-                    $row[$key][$pSequence[1]] = $secondArray[$key];
179
+                $row[ $key ][ $pSequence[ 0 ] ] = $value;
180
+                if (isset($secondArray[ $key ])) {
181
+                    $row[ $key ][ $pSequence[ 1 ] ] = $secondArray[ $key ];
182 182
                 } else {
183
-                    $row[$key][$pSequence[1]] = '';
183
+                    $row[ $key ][ $pSequence[ 1 ] ] = '';
184 184
                 }
185 185
             }
186 186
         }
@@ -189,38 +189,38 @@  discard block
 block discarded – undo
189 189
 
190 190
     private function prepareForOutputForm($inArray)
191 191
     {
192
-        $urlToGetLbl = $this->config['Servers'][$this->config['Defaults']['localConfig']]['url']
192
+        $urlToGetLbl = $this->config[ 'Servers' ][ $this->config[ 'Defaults' ][ 'localConfig' ] ][ 'url' ]
193 193
                 . '?Label=---' . urlencode(' List of known labels');
194
-        $knownLabels = $this->getContentFromUrlThroughCurlAsArrayIfJson($urlToGetLbl)['response'];
194
+        $knownLabels = $this->getContentFromUrlThroughCurlAsArrayIfJson($urlToGetLbl)[ 'response' ];
195 195
         echo $this->setFormOptions([
196
-            'Defaults'     => $this->config['Defaults'],
196
+            'Defaults'     => $this->config[ 'Defaults' ],
197 197
             'KnownLabels'  => $knownLabels,
198
-            'Servers'      => $this->config['Servers'],
199
-            'SuperGlobals' => $inArray['SuperGlobals'],
198
+            'Servers'      => $this->config[ 'Servers' ],
199
+            'SuperGlobals' => $inArray[ 'SuperGlobals' ],
200 200
         ]);
201 201
     }
202 202
 
203 203
     private function processInfos()
204 204
     {
205
-        if (isset($_GET['localConfig']) && isset($_GET['serverConfig'])) {
206
-            $urlArguments              = '?Label=' . urlencode($_GET['Label']);
207
-            $source                    = $this->config['Servers'][$_GET['localConfig']]['url'] . $urlArguments;
205
+        if (isset($_GET[ 'localConfig' ]) && isset($_GET[ 'serverConfig' ])) {
206
+            $urlArguments              = '?Label=' . urlencode($_GET[ 'Label' ]);
207
+            $source                    = $this->config[ 'Servers' ][ $_GET[ 'localConfig' ] ][ 'url' ] . $urlArguments;
208 208
             $this->localConfiguration  = $this->getContentFromUrlThroughCurlAsArrayIfJson($source);
209
-            $destination               = $this->config['Servers'][$_GET['serverConfig']]['url'] . $urlArguments;
209
+            $destination               = $this->config[ 'Servers' ][ $_GET[ 'serverConfig' ] ][ 'url' ] . $urlArguments;
210 210
             $this->serverConfiguration = $this->getContentFromUrlThroughCurlAsArrayIfJson($destination);
211 211
         } else {
212
-            $this->localConfiguration  = ['response' => '', 'info' => ''];
213
-            $this->serverConfiguration = ['response' => '', 'info' => ''];
212
+            $this->localConfiguration  = [ 'response' => '', 'info' => '' ];
213
+            $this->serverConfiguration = [ 'response' => '', 'info' => '' ];
214 214
         }
215 215
     }
216 216
 
217 217
     private function setFooterHtml()
218 218
     {
219
-        $sReturn   = [];
220
-        $sReturn[] = '</div><!-- from main Tabber -->';
221
-        $sReturn[] = '<div class="resetOnly author">&copy; 2015 Daniel Popiniuc</div>';
222
-        $sReturn[] = '<hr/>';
223
-        $sReturn[] = '<div class="disclaimer">'
219
+        $sReturn   = [ ];
220
+        $sReturn[ ] = '</div><!-- from main Tabber -->';
221
+        $sReturn[ ] = '<div class="resetOnly author">&copy; 2015 Daniel Popiniuc</div>';
222
+        $sReturn[ ] = '<hr/>';
223
+        $sReturn[ ] = '<div class="disclaimer">'
224 224
                 . 'The developer cannot be liable of any data input or results, '
225 225
                 . 'included but not limited to any implication of these '
226 226
                 . '(anywhere and whomever there might be these)!'
@@ -232,9 +232,9 @@  discard block
 block discarded – undo
232 232
     {
233 233
         return '<div class="tabbertab" id="tabCurl" title="CURL infos">'
234 234
                 . $this->displayTableFromMultiLevelArray([
235
-                    'source'       => $this->localConfiguration['info'],
236
-                    'destination'  => $this->serverConfiguration['info'],
237
-                    'SuperGlobals' => $inArray['SuperGlobals'],
235
+                    'source'       => $this->localConfiguration[ 'info' ],
236
+                    'destination'  => $this->serverConfiguration[ 'info' ],
237
+                    'SuperGlobals' => $inArray[ 'SuperGlobals' ],
238 238
                 ])
239 239
                 . '</div><!--from tabCurl-->';
240 240
     }
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
     private function setFormInfos($inArray)
243 243
     {
244 244
         return '<div class="tabbertab'
245
-                . (is_null($inArray['SuperGlobals']->get('Label')) ? '' : ' tabbertabdefault')
245
+                . (is_null($inArray[ 'SuperGlobals' ]->get('Label')) ? '' : ' tabbertabdefault')
246 246
                 . '" id="tabConfigs" title="Informations">'
247 247
                 . $this->displayTableFromMultiLevelArray([
248
-                    'source'       => $this->localConfiguration['response'],
249
-                    'destination'  => $this->serverConfiguration['response'],
250
-                    'SuperGlobals' => $inArray['SuperGlobals'],
248
+                    'source'       => $this->localConfiguration[ 'response' ],
249
+                    'destination'  => $this->serverConfiguration[ 'response' ],
250
+                    'SuperGlobals' => $inArray[ 'SuperGlobals' ],
251 251
                 ])
252 252
                 . '</div><!--from tabConfigs-->';
253 253
     }
@@ -256,12 +256,12 @@  discard block
 block discarded – undo
256 256
     {
257 257
         return $this->setHeaderCommon([
258 258
                     'lang'       => 'en-US',
259
-                    'title'      => $this->applicationFlags['name'],
259
+                    'title'      => $this->applicationFlags[ 'name' ],
260 260
                     'css'        => 'css/main.css',
261 261
                     'javascript' => 'js/tabber.min.js',
262 262
                 ])
263 263
                 . $this->setJavascriptContent('document.write(\'<style type="text/css">.tabber{display:none;}</style>\');')
264
-                . '<h1>' . $this->applicationFlags['name'] . '</h1>'
264
+                . '<h1>' . $this->applicationFlags[ 'name' ] . '</h1>'
265 265
                 . '<div class="tabber" id="tab">';
266 266
     }
267 267
 }
Please login to merge, or discard this patch.