@@ -57,7 +57,7 @@ discard block |
||
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 |
||
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 |
||
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,50 +178,50 @@ discard block |
||
178 | 178 | $this->setDefaultOptions(); |
179 | 179 | $rqst = new \Symfony\Component\HttpFoundation\Request; |
180 | 180 | $superGlobals = $rqst->createFromGlobals(); |
181 | - $urlToGetLbl = $this->config['Servers' |
|
182 | - . ''][$this->config['Defaults']['Source']]['url'] |
|
181 | + $urlToGetLbl = $this->config[ 'Servers' |
|
182 | + . '' ][ $this->config[ 'Defaults' ][ 'Source' ] ][ 'url' ] |
|
183 | 183 | . '?Label=---' . urlencode(' List of known labels'); |
184 | - $knownLabels = $this->getContentFromUrlThroughCurlAsArrayIfJson($urlToGetLbl)['response']; |
|
184 | + $knownLabels = $this->getContentFromUrlThroughCurlAsArrayIfJson($urlToGetLbl)[ 'response' ]; |
|
185 | 185 | echo $this->setFormOptions($superGlobals, $knownLabels); |
186 | 186 | } |
187 | 187 | |
188 | 188 | private function processInfos() |
189 | 189 | { |
190 | - if (isset($_GET['localConfig']) && isset($_GET['serverConfig'])) { |
|
191 | - $urlArguments = '?Label=' . urlencode($_GET['Label']); |
|
192 | - $source = $this->config['Servers'][$_GET['localConfig']]['url'] . $urlArguments; |
|
190 | + if (isset($_GET[ 'localConfig' ]) && isset($_GET[ 'serverConfig' ])) { |
|
191 | + $urlArguments = '?Label=' . urlencode($_GET[ 'Label' ]); |
|
192 | + $source = $this->config[ 'Servers' ][ $_GET[ 'localConfig' ] ][ 'url' ] . $urlArguments; |
|
193 | 193 | $this->localConfiguration = $this->getContentFromUrlThroughCurlAsArrayIfJson($source); |
194 | - $destination = $this->config['Servers'][$_GET['serverConfig']]['url'] . $urlArguments; |
|
194 | + $destination = $this->config[ 'Servers' ][ $_GET[ 'serverConfig' ] ][ 'url' ] . $urlArguments; |
|
195 | 195 | $this->serverConfiguration = $this->getContentFromUrlThroughCurlAsArrayIfJson($destination); |
196 | 196 | } else { |
197 | - $this->localConfiguration = ['response' => '', 'info' => '']; |
|
198 | - $this->serverConfiguration = ['response' => '', 'info' => '']; |
|
197 | + $this->localConfiguration = [ 'response' => '', 'info' => '' ]; |
|
198 | + $this->serverConfiguration = [ 'response' => '', 'info' => '' ]; |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
202 | 202 | private function setDefaultOptions() |
203 | 203 | { |
204 | - if (!isset($_GET['displayOnlyDifferent'])) { |
|
205 | - $_GET['displayOnlyDifferent'] = $this->config['Defaults']['ResultsType']; |
|
204 | + if (!isset($_GET[ 'displayOnlyDifferent' ])) { |
|
205 | + $_GET[ 'displayOnlyDifferent' ] = $this->config[ 'Defaults' ][ 'ResultsType' ]; |
|
206 | 206 | } |
207 | - if (!isset($_GET['localConfig'])) { |
|
208 | - $_GET['localConfig'] = $this->config['Defaults']['Source']; |
|
207 | + if (!isset($_GET[ 'localConfig' ])) { |
|
208 | + $_GET[ 'localConfig' ] = $this->config[ 'Defaults' ][ 'Source' ]; |
|
209 | 209 | } |
210 | - if (!isset($_GET['serverConfig'])) { |
|
211 | - $_GET['serverConfig'] = $this->config['Defaults']['Target']; |
|
210 | + if (!isset($_GET[ 'serverConfig' ])) { |
|
211 | + $_GET[ 'serverConfig' ] = $this->config[ 'Defaults' ][ 'Target' ]; |
|
212 | 212 | } |
213 | - if (!isset($_GET['Label'])) { |
|
214 | - $_GET['Label'] = $this->config['Defaults']['Label']; |
|
213 | + if (!isset($_GET[ 'Label' ])) { |
|
214 | + $_GET[ 'Label' ] = $this->config[ 'Defaults' ][ 'Label' ]; |
|
215 | 215 | } |
216 | 216 | } |
217 | 217 | |
218 | 218 | private function setFooterHtml() |
219 | 219 | { |
220 | - $sReturn = []; |
|
221 | - $sReturn[] = '</div><!-- from main Tabber -->'; |
|
222 | - $sReturn[] = '<div class="resetOnly author">© 2015 Daniel Popiniuc</div>'; |
|
223 | - $sReturn[] = '<hr/>'; |
|
224 | - $sReturn[] = '<div class="disclaimer">' |
|
220 | + $sReturn = [ ]; |
|
221 | + $sReturn[ ] = '</div><!-- from main Tabber -->'; |
|
222 | + $sReturn[ ] = '<div class="resetOnly author">© 2015 Daniel Popiniuc</div>'; |
|
223 | + $sReturn[ ] = '<hr/>'; |
|
224 | + $sReturn[ ] = '<div class="disclaimer">' |
|
225 | 225 | . 'The developer cannot be liable of any data input or results, ' |
226 | 226 | . 'included but not limited to any implication of these ' |
227 | 227 | . '(anywhere and whomever there might be these)!' |
@@ -231,8 +231,8 @@ discard block |
||
231 | 231 | |
232 | 232 | private function setFormCurlInfos() |
233 | 233 | { |
234 | - $source = $this->localConfiguration['info']; |
|
235 | - $destination = $this->serverConfiguration['info']; |
|
234 | + $source = $this->localConfiguration[ 'info' ]; |
|
235 | + $destination = $this->serverConfiguration[ 'info' ]; |
|
236 | 236 | return '<div class="tabbertab" id="tabCurl" title="CURL infos">' |
237 | 237 | . $this->displayTableFromMultiLevelArray($source, $destination) |
238 | 238 | . '</div><!--from tabCurl-->'; |
@@ -240,10 +240,10 @@ discard block |
||
240 | 240 | |
241 | 241 | private function setFormInfos() |
242 | 242 | { |
243 | - $source = $this->localConfiguration['response']; |
|
244 | - $destination = $this->serverConfiguration['response']; |
|
243 | + $source = $this->localConfiguration[ 'response' ]; |
|
244 | + $destination = $this->serverConfiguration[ 'response' ]; |
|
245 | 245 | return '<div class="tabbertab' |
246 | - . (isset($_GET['Label']) ? ' tabbertabdefault' : '') |
|
246 | + . (isset($_GET[ 'Label' ]) ? ' tabbertabdefault' : '') |
|
247 | 247 | . '" id="tabConfigs" title="Informations">' |
248 | 248 | . $this->displayTableFromMultiLevelArray($source, $destination) |
249 | 249 | . '</div><!--from tabConfigs-->'; |
@@ -253,12 +253,12 @@ discard block |
||
253 | 253 | { |
254 | 254 | return $this->setHeaderCommon([ |
255 | 255 | 'lang' => 'en-US', |
256 | - 'title' => $this->applicationFlags['name'], |
|
256 | + 'title' => $this->applicationFlags[ 'name' ], |
|
257 | 257 | 'css' => 'css/main.css', |
258 | 258 | 'javascript' => 'js/tabber.min.js', |
259 | 259 | ]) |
260 | 260 | . $this->setJavascriptContent('document.write(\'<style type="text/css">.tabber{display:none;}</style>\');') |
261 | - . '<h1>' . $this->applicationFlags['name'] . '</h1>' |
|
261 | + . '<h1>' . $this->applicationFlags[ 'name' ] . '</h1>' |
|
262 | 262 | . '<div class="tabber" id="tab">'; |
263 | 263 | } |
264 | 264 | } |