Completed
Push — master ( 4d2382...e7cb84 )
by Daniel
02:15
created
source/Compare.php 1 patch
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         ];
58 58
         echo $this->setHeaderHtml();
59 59
         $this->prepareForOutputForm();
60
-        if (isset($_GET['Label'])) {
60
+        if (isset($_GET[ 'Label' ])) {
61 61
             $this->processInfos();
62 62
             echo $this->setFormCurlInfos();
63 63
             echo $this->setFormInfos();
@@ -70,62 +70,62 @@  discard block
 block discarded – undo
70 70
         if ((!is_array($firstArray)) || (!is_array($secondArray))) {
71 71
             return '';
72 72
         }
73
-        $firstRow     = $this->mergeArraysIntoFirstSecond($firstArray, $secondArray, ['first', 'second']);
74
-        $secondRow    = $this->mergeArraysIntoFirstSecond($secondArray, $firstArray, ['second', 'first']);
73
+        $firstRow     = $this->mergeArraysIntoFirstSecond($firstArray, $secondArray, [ 'first', 'second' ]);
74
+        $secondRow    = $this->mergeArraysIntoFirstSecond($secondArray, $firstArray, [ 'second', 'first' ]);
75 75
         $row          = array_merge($firstRow, $secondRow);
76 76
         ksort($row);
77
-        $urlArguments = '?Label=' . $_GET['Label'];
78
-        $sString[]    = '<table style="width:100%">'
77
+        $urlArguments = '?Label=' . $_GET[ 'Label' ];
78
+        $sString[ ]    = '<table style="width:100%">'
79 79
                 . '<thead><tr>'
80 80
                 . '<th>Identifier</th>'
81
-                . '<th><a href="' . $this->config['Servers'][$_GET['localConfig']]['url']
81
+                . '<th><a href="' . $this->config[ 'Servers' ][ $_GET[ 'localConfig' ] ][ 'url' ]
82 82
                 . $urlArguments . '" target="_blank">'
83
-                . $this->config['Servers'][$_GET['localConfig']]['name'] . '</a></th>'
84
-                . '<th><a href="' . $this->config['Servers'][$_GET['serverConfig']]['url']
83
+                . $this->config[ 'Servers' ][ $_GET[ 'localConfig' ] ][ 'name' ] . '</a></th>'
84
+                . '<th><a href="' . $this->config[ 'Servers' ][ $_GET[ 'serverConfig' ] ][ 'url' ]
85 85
                 . $urlArguments . '" target="_blank">'
86
-                . $this->config['Servers'][$_GET['serverConfig']]['name'] . '</a></th>'
86
+                . $this->config[ 'Servers' ][ $_GET[ 'serverConfig' ] ][ 'name' ] . '</a></th>'
87 87
                 . '</tr></thead>'
88 88
                 . '<tbody>';
89
-        if ($_GET['displayOnlyDifferent'] == '1') {
89
+        if ($_GET[ 'displayOnlyDifferent' ] == '1') {
90 90
             $displayOnlyDifferent = true;
91 91
         } else {
92 92
             $displayOnlyDifferent = false;
93 93
         }
94 94
         foreach ($row as $key => $value) {
95 95
             $rowString = '<tr><td style="width:20%;">' . $key . '</td><td style="width:40%;">'
96
-                    . str_replace(',', ', ', $value['first']) . '</td><td style="width:40%;">'
97
-                    . str_replace(',', ', ', $value['second']) . '</td></tr>';
96
+                    . str_replace(',', ', ', $value[ 'first' ]) . '</td><td style="width:40%;">'
97
+                    . str_replace(',', ', ', $value[ 'second' ]) . '</td></tr>';
98 98
             if ($displayOnlyDifferent) {
99
-                if ($value['first'] != $value['second']) {
100
-                    $sString[] = $rowString;
99
+                if ($value[ 'first' ] != $value[ 'second' ]) {
100
+                    $sString[ ] = $rowString;
101 101
                 }
102 102
             } else {
103
-                $sString[] = $rowString;
103
+                $sString[ ] = $rowString;
104 104
             }
105 105
         }
106
-        $sString[] = '</tbody></table>';
106
+        $sString[ ] = '</tbody></table>';
107 107
         return implode('', $sString);
108 108
     }
109 109
 
110 110
     private function getConfiguration()
111 111
     {
112 112
         $storedConfiguration = $this->configuredDeployedInformators();
113
-        foreach ($storedConfiguration['informators'] as $key => $value) {
114
-            $this->config['Servers'][] = [
113
+        foreach ($storedConfiguration[ 'informators' ] as $key => $value) {
114
+            $this->config[ 'Servers' ][ ] = [
115 115
                 'name' => $key,
116 116
                 'url'  => $value,
117 117
             ];
118 118
         }
119
-        $haystack                                = array_keys($storedConfiguration['informators']);
120
-        $this->config['Defaults']['Label']       = $storedConfiguration['default']['label'];
121
-        $this->config['Defaults']['Source']      = array_search($storedConfiguration['default']['source'], $haystack);
122
-        $this->config['Defaults']['Target']      = array_search($storedConfiguration['default']['target'], $haystack);
123
-        $this->config['Defaults']['ResultsType'] = $storedConfiguration['default']['typeOfResults'];
119
+        $haystack                                = array_keys($storedConfiguration[ 'informators' ]);
120
+        $this->config[ 'Defaults' ][ 'Label' ]       = $storedConfiguration[ 'default' ][ 'label' ];
121
+        $this->config[ 'Defaults' ][ 'Source' ]      = array_search($storedConfiguration[ 'default' ][ 'source' ], $haystack);
122
+        $this->config[ 'Defaults' ][ 'Target' ]      = array_search($storedConfiguration[ 'default' ][ 'target' ], $haystack);
123
+        $this->config[ 'Defaults' ][ 'ResultsType' ] = $storedConfiguration[ 'default' ][ 'typeOfResults' ];
124 124
     }
125 125
 
126
-    private function mergeArraysIntoFirstSecond($firstArray, $secondArray, $pSequence = ['first', 'second'])
126
+    private function mergeArraysIntoFirstSecond($firstArray, $secondArray, $pSequence = [ 'first', 'second' ])
127 127
     {
128
-        $row = [];
128
+        $row = [ ];
129 129
         foreach ($firstArray as $key => $value) {
130 130
             if (is_array($value)) {
131 131
                 foreach ($value as $key2 => $value2) {
@@ -134,39 +134,39 @@  discard block
 block discarded – undo
134 134
                             if (is_array($value3)) {
135 135
                                 foreach ($value3 as $key4 => $value4) {
136 136
                                     $keyCrt                      = $key . '_' . $key2 . '__' . $key3 . '__' . $key4;
137
-                                    $row[$keyCrt][$pSequence[0]] = $value4;
138
-                                    if (isset($secondArray[$key][$key2][$key3][$key4])) {
139
-                                        $row[$keyCrt][$pSequence[1]] = $secondArray[$key][$key2][$key3][$key4];
137
+                                    $row[ $keyCrt ][ $pSequence[ 0 ] ] = $value4;
138
+                                    if (isset($secondArray[ $key ][ $key2 ][ $key3 ][ $key4 ])) {
139
+                                        $row[ $keyCrt ][ $pSequence[ 1 ] ] = $secondArray[ $key ][ $key2 ][ $key3 ][ $key4 ];
140 140
                                     } else {
141
-                                        $row[$keyCrt][$pSequence[1]] = '';
141
+                                        $row[ $keyCrt ][ $pSequence[ 1 ] ] = '';
142 142
                                     }
143 143
                                 }
144 144
                             } else {
145 145
                                 $keyCrt                      = $key . '_' . $key2 . '__' . $key3;
146
-                                $row[$keyCrt][$pSequence[0]] = $value3;
147
-                                if (isset($secondArray[$key][$key2][$key3])) {
148
-                                    $row[$keyCrt][$pSequence[1]] = $secondArray[$key][$key2][$key3];
146
+                                $row[ $keyCrt ][ $pSequence[ 0 ] ] = $value3;
147
+                                if (isset($secondArray[ $key ][ $key2 ][ $key3 ])) {
148
+                                    $row[ $keyCrt ][ $pSequence[ 1 ] ] = $secondArray[ $key ][ $key2 ][ $key3 ];
149 149
                                 } else {
150
-                                    $row[$keyCrt][$pSequence[1]] = '';
150
+                                    $row[ $keyCrt ][ $pSequence[ 1 ] ] = '';
151 151
                                 }
152 152
                             }
153 153
                         }
154 154
                     } else {
155 155
                         $keyCrt                      = $key . '_' . $key2;
156
-                        $row[$keyCrt][$pSequence[0]] = $value2;
157
-                        if (isset($secondArray[$key][$key2])) {
158
-                            $row[$keyCrt][$pSequence[1]] = $secondArray[$key][$key2];
156
+                        $row[ $keyCrt ][ $pSequence[ 0 ] ] = $value2;
157
+                        if (isset($secondArray[ $key ][ $key2 ])) {
158
+                            $row[ $keyCrt ][ $pSequence[ 1 ] ] = $secondArray[ $key ][ $key2 ];
159 159
                         } else {
160
-                            $row[$keyCrt][$pSequence[1]] = '';
160
+                            $row[ $keyCrt ][ $pSequence[ 1 ] ] = '';
161 161
                         }
162 162
                     }
163 163
                 }
164 164
             } else {
165
-                $row[$key][$pSequence[0]] = $value;
166
-                if (isset($secondArray[$key])) {
167
-                    $row[$key][$pSequence[1]] = $secondArray[$key];
165
+                $row[ $key ][ $pSequence[ 0 ] ] = $value;
166
+                if (isset($secondArray[ $key ])) {
167
+                    $row[ $key ][ $pSequence[ 1 ] ] = $secondArray[ $key ];
168 168
                 } else {
169
-                    $row[$key][$pSequence[1]] = '';
169
+                    $row[ $key ][ $pSequence[ 1 ] ] = '';
170 170
                 }
171 171
             }
172 172
         }
@@ -178,53 +178,53 @@  discard block
 block discarded – undo
178 178
         $this->setDefaultOptions();
179 179
         $rqst         = new \Symfony\Component\HttpFoundation\Request;
180 180
         $superGlobals = $rqst->createFromGlobals();
181
-        $urlToGetLbl  = $this->config['Servers'][$this->config['Defaults']['Source']]['url']
181
+        $urlToGetLbl  = $this->config[ 'Servers' ][ $this->config[ 'Defaults' ][ 'Source' ] ][ 'url' ]
182 182
                 . '?Label=---' . urlencode(' List of known labels');
183
-        $knownLabels  = $this->getContentFromUrlThroughCurlAsArrayIfJson($urlToGetLbl)['response'];
183
+        $knownLabels  = $this->getContentFromUrlThroughCurlAsArrayIfJson($urlToGetLbl)[ 'response' ];
184 184
         echo $this->setFormOptions([
185 185
             'KnownLabels'  => $knownLabels,
186
-            'Servers'      => $this->config['Servers'],
186
+            'Servers'      => $this->config[ 'Servers' ],
187 187
             'SuperGlobals' => $superGlobals,
188 188
         ]);
189 189
     }
190 190
 
191 191
     private function processInfos()
192 192
     {
193
-        if (isset($_GET['localConfig']) && isset($_GET['serverConfig'])) {
194
-            $urlArguments              = '?Label=' . urlencode($_GET['Label']);
195
-            $source                    = $this->config['Servers'][$_GET['localConfig']]['url'] . $urlArguments;
193
+        if (isset($_GET[ 'localConfig' ]) && isset($_GET[ 'serverConfig' ])) {
194
+            $urlArguments              = '?Label=' . urlencode($_GET[ 'Label' ]);
195
+            $source                    = $this->config[ 'Servers' ][ $_GET[ 'localConfig' ] ][ 'url' ] . $urlArguments;
196 196
             $this->localConfiguration  = $this->getContentFromUrlThroughCurlAsArrayIfJson($source);
197
-            $destination               = $this->config['Servers'][$_GET['serverConfig']]['url'] . $urlArguments;
197
+            $destination               = $this->config[ 'Servers' ][ $_GET[ 'serverConfig' ] ][ 'url' ] . $urlArguments;
198 198
             $this->serverConfiguration = $this->getContentFromUrlThroughCurlAsArrayIfJson($destination);
199 199
         } else {
200
-            $this->localConfiguration  = ['response' => '', 'info' => ''];
201
-            $this->serverConfiguration = ['response' => '', 'info' => ''];
200
+            $this->localConfiguration  = [ 'response' => '', 'info' => '' ];
201
+            $this->serverConfiguration = [ 'response' => '', 'info' => '' ];
202 202
         }
203 203
     }
204 204
 
205 205
     private function setDefaultOptions()
206 206
     {
207
-        if (!isset($_GET['displayOnlyDifferent'])) {
208
-            $_GET['displayOnlyDifferent'] = $this->config['Defaults']['ResultsType'];
207
+        if (!isset($_GET[ 'displayOnlyDifferent' ])) {
208
+            $_GET[ 'displayOnlyDifferent' ] = $this->config[ 'Defaults' ][ 'ResultsType' ];
209 209
         }
210
-        if (!isset($_GET['localConfig'])) {
211
-            $_GET['localConfig'] = $this->config['Defaults']['Source'];
210
+        if (!isset($_GET[ 'localConfig' ])) {
211
+            $_GET[ 'localConfig' ] = $this->config[ 'Defaults' ][ 'Source' ];
212 212
         }
213
-        if (!isset($_GET['serverConfig'])) {
214
-            $_GET['serverConfig'] = $this->config['Defaults']['Target'];
213
+        if (!isset($_GET[ 'serverConfig' ])) {
214
+            $_GET[ 'serverConfig' ] = $this->config[ 'Defaults' ][ 'Target' ];
215 215
         }
216
-        if (!isset($_GET['Label'])) {
217
-            $_GET['Label'] = $this->config['Defaults']['Label'];
216
+        if (!isset($_GET[ 'Label' ])) {
217
+            $_GET[ 'Label' ] = $this->config[ 'Defaults' ][ 'Label' ];
218 218
         }
219 219
     }
220 220
 
221 221
     private function setFooterHtml()
222 222
     {
223
-        $sReturn   = [];
224
-        $sReturn[] = '</div><!-- from main Tabber -->';
225
-        $sReturn[] = '<div class="resetOnly author">&copy; 2015 Daniel Popiniuc</div>';
226
-        $sReturn[] = '<hr/>';
227
-        $sReturn[] = '<div class="disclaimer">'
223
+        $sReturn   = [ ];
224
+        $sReturn[ ] = '</div><!-- from main Tabber -->';
225
+        $sReturn[ ] = '<div class="resetOnly author">&copy; 2015 Daniel Popiniuc</div>';
226
+        $sReturn[ ] = '<hr/>';
227
+        $sReturn[ ] = '<div class="disclaimer">'
228 228
                 . 'The developer cannot be liable of any data input or results, '
229 229
                 . 'included but not limited to any implication of these '
230 230
                 . '(anywhere and whomever there might be these)!'
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
 
235 235
     private function setFormCurlInfos()
236 236
     {
237
-        $source      = $this->localConfiguration['info'];
238
-        $destination = $this->serverConfiguration['info'];
237
+        $source      = $this->localConfiguration[ 'info' ];
238
+        $destination = $this->serverConfiguration[ 'info' ];
239 239
         return '<div class="tabbertab" id="tabCurl" title="CURL infos">'
240 240
                 . $this->displayTableFromMultiLevelArray($source, $destination)
241 241
                 . '</div><!--from tabCurl-->';
@@ -243,10 +243,10 @@  discard block
 block discarded – undo
243 243
 
244 244
     private function setFormInfos()
245 245
     {
246
-        $source      = $this->localConfiguration['response'];
247
-        $destination = $this->serverConfiguration['response'];
246
+        $source      = $this->localConfiguration[ 'response' ];
247
+        $destination = $this->serverConfiguration[ 'response' ];
248 248
         return '<div class="tabbertab'
249
-                . (isset($_GET['Label']) ? ' tabbertabdefault' : '')
249
+                . (isset($_GET[ 'Label' ]) ? ' tabbertabdefault' : '')
250 250
                 . '" id="tabConfigs" title="Informations">'
251 251
                 . $this->displayTableFromMultiLevelArray($source, $destination)
252 252
                 . '</div><!--from tabConfigs-->';
@@ -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.
source/OutputFormBuilder.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 
32 32
     private function listOfKnownLabels($inArray)
33 33
     {
34
-        $informatorKnownLabels = array_diff($inArray['KnownLabels'], ['--- List of known labels']);
35
-        $tmpOptions            = [];
34
+        $informatorKnownLabels = array_diff($inArray[ 'KnownLabels' ], [ '--- List of known labels' ]);
35
+        $tmpOptions            = [ ];
36 36
         foreach ($informatorKnownLabels as $value) {
37
-            $tmpOptions[] = '<input type="radio" name="Label" id="Label_' . $value . '" value="' . $value . '" '
37
+            $tmpOptions[ ] = '<input type="radio" name="Label" id="Label_' . $value . '" value="' . $value . '" '
38 38
                     . $this->turnRequestedValueIntoCheckboxStatus([
39
-                        'SuperGlobals'  => $inArray['SuperGlobals'],
39
+                        'SuperGlobals'  => $inArray[ 'SuperGlobals' ],
40 40
                         'RequestedName' => 'Label',
41 41
                         'CheckedValue'  => $value,
42 42
                     ])
@@ -51,46 +51,46 @@  discard block
 block discarded – undo
51 51
 
52 52
     private function providers($inArray)
53 53
     {
54
-        $tmpOptions = [];
55
-        foreach ($inArray['Servers'] as $key => $value) {
56
-            $tmpOptions[] = '<a href="' . $value['url'] . '" target="_blank">run-me</a>&nbsp;'
57
-                    . '<input type="radio" name="' . $inArray['ConfigName'] . '" id="'
58
-                    . $inArray['ConfigName'] . '_' . $key . '" value="' . $key . '" '
54
+        $tmpOptions = [ ];
55
+        foreach ($inArray[ 'Servers' ] as $key => $value) {
56
+            $tmpOptions[ ] = '<a href="' . $value[ 'url' ] . '" target="_blank">run-me</a>&nbsp;'
57
+                    . '<input type="radio" name="' . $inArray[ 'ConfigName' ] . '" id="'
58
+                    . $inArray[ 'ConfigName' ] . '_' . $key . '" value="' . $key . '" '
59 59
                     . $this->turnRequestedValueIntoCheckboxStatus([
60
-                        'SuperGlobals'  => $inArray['SuperGlobals'],
61
-                        'RequestedName' => $inArray['ConfigName'],
60
+                        'SuperGlobals'  => $inArray[ 'SuperGlobals' ],
61
+                        'RequestedName' => $inArray[ 'ConfigName' ],
62 62
                         'CheckedValue'  => (string) $key,
63 63
                     ])
64 64
                     . '/>'
65
-                    . '<label for="' . $inArray['ConfigName'] . '_' . $key . '">' . $value['name'] . '</label>';
65
+                    . '<label for="' . $inArray[ 'ConfigName' ] . '_' . $key . '">' . $value[ 'name' ] . '</label>';
66 66
         }
67 67
         return '<fieldset style="float:left;">'
68
-                . '<legend>' . $inArray['TitleStart'] . ' config providers</legend>'
68
+                . '<legend>' . $inArray[ 'TitleStart' ] . ' config providers</legend>'
69 69
                 . implode('<br/>', $tmpOptions)
70 70
                 . '</fieldset>';
71 71
     }
72 72
 
73 73
     protected function setFormOptions($inArray)
74 74
     {
75
-        $sReturn   = [];
76
-        $sReturn[] = $this->typeOfResults($inArray['SuperGlobals']);
77
-        $sReturn[] = $this->providers([
75
+        $sReturn   = [ ];
76
+        $sReturn[ ] = $this->typeOfResults($inArray[ 'SuperGlobals' ]);
77
+        $sReturn[ ] = $this->providers([
78 78
             'ConfigName'   => 'localConfig',
79
-            'Servers'      => $inArray['Servers'],
80
-            'SuperGlobals' => $inArray['SuperGlobals'],
79
+            'Servers'      => $inArray[ 'Servers' ],
80
+            'SuperGlobals' => $inArray[ 'SuperGlobals' ],
81 81
             'TitleStart'   => 'Source',
82 82
         ]);
83
-        $sReturn[] = $this->providers([
83
+        $sReturn[ ] = $this->providers([
84 84
             'ConfigName'   => 'serverConfig',
85
-            'Servers'      => $inArray['Servers'],
86
-            'SuperGlobals' => $inArray['SuperGlobals'],
85
+            'Servers'      => $inArray[ 'Servers' ],
86
+            'SuperGlobals' => $inArray[ 'SuperGlobals' ],
87 87
             'TitleStart'   => 'Target',
88 88
         ]);
89
-        $sReturn[] = $this->listOfKnownLabels($inArray);
89
+        $sReturn[ ] = $this->listOfKnownLabels($inArray);
90 90
         return '<div class="tabbertab" id="tabOptions" title="Options">'
91 91
                 . '<style type="text/css" media="all" scoped>label { width: auto; }</style>'
92 92
                 . '<form method="get" action="'
93
-                . $inArray['SuperGlobals']->server->get('PHP_SELF')
93
+                . $inArray[ 'SuperGlobals' ]->server->get('PHP_SELF')
94 94
                 . '">'
95 95
                 . '<input type="submit" value="Apply" />'
96 96
                 . '<br/>' . implode('', $sReturn)
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
     private function turnRequestedValueIntoCheckboxStatus($inArray)
103 103
     {
104 104
         $checkboxStatus = '';
105
-        if ($inArray['SuperGlobals']->get($inArray['RequestedName']) === $inArray['CheckedValue']) {
105
+        if ($inArray[ 'SuperGlobals' ]->get($inArray[ 'RequestedName' ]) === $inArray[ 'CheckedValue' ]) {
106 106
             $checkboxStatus = 'checked ';
107 107
         }
108 108
         return $checkboxStatus;
Please login to merge, or discard this patch.