@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | echo $this->setHeaderHtml(); |
52 | 52 | $rqst = new \Symfony\Component\HttpFoundation\Request; |
53 | 53 | $superGlobals = $rqst->createFromGlobals(); |
54 | - $this->prepareForOutputForm(['SuperGlobals' => $superGlobals]); |
|
54 | + $this->prepareForOutputForm([ 'SuperGlobals' => $superGlobals ]); |
|
55 | 55 | if (!is_null($superGlobals->get('Label'))) { |
56 | - $this->processInfos(['sGlobals' => $superGlobals]); |
|
57 | - echo $this->setFormCurlInfos(['SuperGlobals' => $superGlobals]); |
|
58 | - echo $this->setFormInfos(['SuperGlobals' => $superGlobals]); |
|
56 | + $this->processInfos([ 'sGlobals' => $superGlobals ]); |
|
57 | + echo $this->setFormCurlInfos([ 'SuperGlobals' => $superGlobals ]); |
|
58 | + echo $this->setFormInfos([ 'SuperGlobals' => $superGlobals ]); |
|
59 | 59 | } |
60 | 60 | echo $this->setFooterHtml(); |
61 | 61 | } |
@@ -63,45 +63,45 @@ discard block |
||
63 | 63 | private function getConfiguration() |
64 | 64 | { |
65 | 65 | $strdConfig = $this->configuredDeployedInformators(); |
66 | - foreach ($strdConfig['informators'] as $key => $value) { |
|
67 | - $this->config['Servers'][] = [ |
|
66 | + foreach ($strdConfig[ 'informators' ] as $key => $value) { |
|
67 | + $this->config[ 'Servers' ][ ] = [ |
|
68 | 68 | 'name' => $key, |
69 | 69 | 'url' => $value, |
70 | 70 | ]; |
71 | 71 | } |
72 | - $haystack = array_keys($strdConfig['informators']); |
|
73 | - $this->config['Defaults']['Label'] = $strdConfig['default']['label']; |
|
74 | - $this->config['Defaults']['localConfig'] = array_search($strdConfig['default']['source'], $haystack); |
|
75 | - $this->config['Defaults']['serverConfig'] = array_search($strdConfig['default']['target'], $haystack); |
|
76 | - $this->config['Defaults']['displayOnlyDifferent'] = $strdConfig['default']['typeOfResults']; |
|
72 | + $haystack = array_keys($strdConfig[ 'informators' ]); |
|
73 | + $this->config[ 'Defaults' ][ 'Label' ] = $strdConfig[ 'default' ][ 'label' ]; |
|
74 | + $this->config[ 'Defaults' ][ 'localConfig' ] = array_search($strdConfig[ 'default' ][ 'source' ], $haystack); |
|
75 | + $this->config[ 'Defaults' ][ 'serverConfig' ] = array_search($strdConfig[ 'default' ][ 'target' ], $haystack); |
|
76 | + $this->config[ 'Defaults' ][ 'displayOnlyDifferent' ] = $strdConfig[ 'default' ][ 'typeOfResults' ]; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | private function prepareForOutputForm($inArray) |
80 | 80 | { |
81 | - $urlToGetLbl = $this->config['Servers'][$this->config['Defaults']['localConfig']]['url'] |
|
81 | + $urlToGetLbl = $this->config[ 'Servers' ][ $this->config[ 'Defaults' ][ 'localConfig' ] ][ 'url' ] |
|
82 | 82 | . '?Label=---' . urlencode(' List of known labels'); |
83 | - $knownLabels = $this->getContentFromUrlThroughCurlAsArrayIfJson($urlToGetLbl)['response']; |
|
83 | + $knownLabels = $this->getContentFromUrlThroughCurlAsArrayIfJson($urlToGetLbl)[ 'response' ]; |
|
84 | 84 | echo $this->setOutputForm([ |
85 | - 'Defaults' => $this->config['Defaults'], |
|
85 | + 'Defaults' => $this->config[ 'Defaults' ], |
|
86 | 86 | 'KnownLabels' => $knownLabels, |
87 | - 'Servers' => $this->config['Servers'], |
|
88 | - 'SuperGlobals' => $inArray['SuperGlobals'], |
|
87 | + 'Servers' => $this->config[ 'Servers' ], |
|
88 | + 'SuperGlobals' => $inArray[ 'SuperGlobals' ], |
|
89 | 89 | ]); |
90 | 90 | } |
91 | 91 | |
92 | 92 | private function processInfos($inArray) |
93 | 93 | { |
94 | - if (!is_null($inArray['sGlobals']->get('localConfig')) && !is_null($inArray['sGlobals']->get('serverConfig'))) { |
|
95 | - $urlArguments = '?Label=' . urlencode($inArray['sGlobals']->get('Label')); |
|
96 | - $source = $this->config['Servers'][$inArray['sGlobals']->get('localConfig')]['url'] |
|
94 | + if (!is_null($inArray[ 'sGlobals' ]->get('localConfig')) && !is_null($inArray[ 'sGlobals' ]->get('serverConfig'))) { |
|
95 | + $urlArguments = '?Label=' . urlencode($inArray[ 'sGlobals' ]->get('Label')); |
|
96 | + $source = $this->config[ 'Servers' ][ $inArray[ 'sGlobals' ]->get('localConfig') ][ 'url' ] |
|
97 | 97 | . $urlArguments; |
98 | 98 | $this->localConfiguration = $this->getContentFromUrlThroughCurlAsArrayIfJson($source); |
99 | - $destination = $this->config['Servers'][$inArray['sGlobals']->get('serverConfig')]['url'] |
|
99 | + $destination = $this->config[ 'Servers' ][ $inArray[ 'sGlobals' ]->get('serverConfig') ][ 'url' ] |
|
100 | 100 | . $urlArguments; |
101 | 101 | $this->serverConfiguration = $this->getContentFromUrlThroughCurlAsArrayIfJson($destination); |
102 | 102 | } else { |
103 | - $this->localConfiguration = ['response' => '', 'info' => '']; |
|
104 | - $this->serverConfiguration = ['response' => '', 'info' => '']; |
|
103 | + $this->localConfiguration = [ 'response' => '', 'info' => '' ]; |
|
104 | + $this->serverConfiguration = [ 'response' => '', 'info' => '' ]; |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | { |
122 | 122 | return '<div class="tabbertab" id="tabCurl" title="CURL infos">' |
123 | 123 | . $this->displayTableFromMultiLevelArray([ |
124 | - 'source' => $this->localConfiguration['info'], |
|
125 | - 'destination' => $this->serverConfiguration['info'], |
|
126 | - 'Servers' => $this->config['Servers'], |
|
127 | - 'SuperGlobals' => $inArray['SuperGlobals'], |
|
124 | + 'source' => $this->localConfiguration[ 'info' ], |
|
125 | + 'destination' => $this->serverConfiguration[ 'info' ], |
|
126 | + 'Servers' => $this->config[ 'Servers' ], |
|
127 | + 'SuperGlobals' => $inArray[ 'SuperGlobals' ], |
|
128 | 128 | ]) |
129 | 129 | . '</div><!--from tabCurl-->'; |
130 | 130 | } |
@@ -132,13 +132,13 @@ discard block |
||
132 | 132 | private function setFormInfos($inArray) |
133 | 133 | { |
134 | 134 | return '<div class="tabbertab' |
135 | - . (is_null($inArray['SuperGlobals']->get('Label')) ? '' : ' tabbertabdefault') |
|
135 | + . (is_null($inArray[ 'SuperGlobals' ]->get('Label')) ? '' : ' tabbertabdefault') |
|
136 | 136 | . '" id="tabConfigs" title="Informations">' |
137 | 137 | . $this->displayTableFromMultiLevelArray([ |
138 | - 'source' => $this->localConfiguration['response'], |
|
139 | - 'destination' => $this->serverConfiguration['response'], |
|
140 | - 'Servers' => $this->config['Servers'], |
|
141 | - 'SuperGlobals' => $inArray['SuperGlobals'], |
|
138 | + 'source' => $this->localConfiguration[ 'response' ], |
|
139 | + 'destination' => $this->serverConfiguration[ 'response' ], |
|
140 | + 'Servers' => $this->config[ 'Servers' ], |
|
141 | + 'SuperGlobals' => $inArray[ 'SuperGlobals' ], |
|
142 | 142 | ]) |
143 | 143 | . '</div><!--from tabConfigs-->'; |
144 | 144 | } |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | trait CompareResults |
30 | 30 | { |
31 | 31 | |
32 | - protected function mergeArraysIntoFirstSecond($firstArray, $secondArray, $pSequence = ['first', 'second']) |
|
32 | + protected function mergeArraysIntoFirstSecond($firstArray, $secondArray, $pSequence = [ 'first', 'second' ]) |
|
33 | 33 | { |
34 | - $row = []; |
|
34 | + $row = [ ]; |
|
35 | 35 | foreach ($firstArray as $key => $value) { |
36 | 36 | if (is_array($value)) { |
37 | 37 | foreach ($value as $key2 => $value2) { |
@@ -40,39 +40,39 @@ discard block |
||
40 | 40 | if (is_array($value3)) { |
41 | 41 | foreach ($value3 as $key4 => $value4) { |
42 | 42 | $keyCrt = $key . '_' . $key2 . '__' . $key3 . '__' . $key4; |
43 | - $row[$keyCrt][$pSequence[0]] = $value4; |
|
44 | - if (isset($secondArray[$key][$key2][$key3][$key4])) { |
|
45 | - $row[$keyCrt][$pSequence[1]] = $secondArray[$key][$key2][$key3][$key4]; |
|
43 | + $row[ $keyCrt ][ $pSequence[ 0 ] ] = $value4; |
|
44 | + if (isset($secondArray[ $key ][ $key2 ][ $key3 ][ $key4 ])) { |
|
45 | + $row[ $keyCrt ][ $pSequence[ 1 ] ] = $secondArray[ $key ][ $key2 ][ $key3 ][ $key4 ]; |
|
46 | 46 | } else { |
47 | - $row[$keyCrt][$pSequence[1]] = ''; |
|
47 | + $row[ $keyCrt ][ $pSequence[ 1 ] ] = ''; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | } else { |
51 | 51 | $keyCrt = $key . '_' . $key2 . '__' . $key3; |
52 | - $row[$keyCrt][$pSequence[0]] = $value3; |
|
53 | - if (isset($secondArray[$key][$key2][$key3])) { |
|
54 | - $row[$keyCrt][$pSequence[1]] = $secondArray[$key][$key2][$key3]; |
|
52 | + $row[ $keyCrt ][ $pSequence[ 0 ] ] = $value3; |
|
53 | + if (isset($secondArray[ $key ][ $key2 ][ $key3 ])) { |
|
54 | + $row[ $keyCrt ][ $pSequence[ 1 ] ] = $secondArray[ $key ][ $key2 ][ $key3 ]; |
|
55 | 55 | } else { |
56 | - $row[$keyCrt][$pSequence[1]] = ''; |
|
56 | + $row[ $keyCrt ][ $pSequence[ 1 ] ] = ''; |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | } |
60 | 60 | } else { |
61 | 61 | $keyCrt = $key . '_' . $key2; |
62 | - $row[$keyCrt][$pSequence[0]] = $value2; |
|
63 | - if (isset($secondArray[$key][$key2])) { |
|
64 | - $row[$keyCrt][$pSequence[1]] = $secondArray[$key][$key2]; |
|
62 | + $row[ $keyCrt ][ $pSequence[ 0 ] ] = $value2; |
|
63 | + if (isset($secondArray[ $key ][ $key2 ])) { |
|
64 | + $row[ $keyCrt ][ $pSequence[ 1 ] ] = $secondArray[ $key ][ $key2 ]; |
|
65 | 65 | } else { |
66 | - $row[$keyCrt][$pSequence[1]] = ''; |
|
66 | + $row[ $keyCrt ][ $pSequence[ 1 ] ] = ''; |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | } |
70 | 70 | } else { |
71 | - $row[$key][$pSequence[0]] = $value; |
|
72 | - if (isset($secondArray[$key])) { |
|
73 | - $row[$key][$pSequence[1]] = $secondArray[$key]; |
|
71 | + $row[ $key ][ $pSequence[ 0 ] ] = $value; |
|
72 | + if (isset($secondArray[ $key ])) { |
|
73 | + $row[ $key ][ $pSequence[ 1 ] ] = $secondArray[ $key ]; |
|
74 | 74 | } else { |
75 | - $row[$key][$pSequence[1]] = ''; |
|
75 | + $row[ $key ][ $pSequence[ 1 ] ] = ''; |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | } |
@@ -35,15 +35,15 @@ discard block |
||
35 | 35 | |
36 | 36 | protected function displayTableFromMultiLevelArray($inArray) |
37 | 37 | { |
38 | - if ((!is_array($inArray['source'])) || (!is_array($inArray['destination']))) { |
|
38 | + if ((!is_array($inArray[ 'source' ])) || (!is_array($inArray[ 'destination' ]))) { |
|
39 | 39 | return ''; |
40 | 40 | } |
41 | - $this->superGlobals = $inArray['SuperGlobals']; |
|
41 | + $this->superGlobals = $inArray[ 'SuperGlobals' ]; |
|
42 | 42 | return '<table style="width:100%">' |
43 | - . $this->tableHeader(['Servers' => $inArray['Servers']]) |
|
43 | + . $this->tableHeader([ 'Servers' => $inArray[ 'Servers' ] ]) |
|
44 | 44 | . $this->tableBody([ |
45 | - 'source' => $inArray['source'], |
|
46 | - 'destination' => $inArray['destination'], |
|
45 | + 'source' => $inArray[ 'source' ], |
|
46 | + 'destination' => $inArray[ 'destination' ], |
|
47 | 47 | ]) |
48 | 48 | . '</table>'; |
49 | 49 | } |
@@ -60,22 +60,22 @@ discard block |
||
60 | 60 | private function displayTableRow($inArray) |
61 | 61 | { |
62 | 62 | $sString = ''; |
63 | - if ($inArray['displayOnlyDifferent']) { |
|
64 | - if ($inArray['first'] != $inArray['second']) { |
|
65 | - $sString = $inArray['rowContent']; |
|
63 | + if ($inArray[ 'displayOnlyDifferent' ]) { |
|
64 | + if ($inArray[ 'first' ] != $inArray[ 'second' ]) { |
|
65 | + $sString = $inArray[ 'rowContent' ]; |
|
66 | 66 | } |
67 | 67 | } else { |
68 | - $sString = $inArray['rowContent']; |
|
68 | + $sString = $inArray[ 'rowContent' ]; |
|
69 | 69 | } |
70 | 70 | return $sString; |
71 | 71 | } |
72 | 72 | |
73 | 73 | private function prepareArrayForTableBody($inArray) |
74 | 74 | { |
75 | - $source = $inArray['source']; |
|
76 | - $dest = $inArray['destination']; |
|
77 | - $firstRow = $this->mergeArraysIntoFirstSecond($source, $dest, ['first', 'second']); |
|
78 | - $secondRow = $this->mergeArraysIntoFirstSecond($dest, $source, ['second', 'first']); |
|
75 | + $source = $inArray[ 'source' ]; |
|
76 | + $dest = $inArray[ 'destination' ]; |
|
77 | + $firstRow = $this->mergeArraysIntoFirstSecond($source, $dest, [ 'first', 'second' ]); |
|
78 | + $secondRow = $this->mergeArraysIntoFirstSecond($dest, $source, [ 'second', 'first' ]); |
|
79 | 79 | $row = array_merge($firstRow, $secondRow); |
80 | 80 | ksort($row); |
81 | 81 | return $row; |
@@ -85,16 +85,16 @@ discard block |
||
85 | 85 | { |
86 | 86 | $row = $this->prepareArrayForTableBody($inArray); |
87 | 87 | $displayOnlyDifferent = $this->decideDisplayAllOrOnlyDifferent(); |
88 | - $aString = []; |
|
88 | + $aString = [ ]; |
|
89 | 89 | foreach ($row as $key => $value) { |
90 | 90 | $rowString = '<tr><td style="width:20%;">' . $key . '</td><td style="width:40%;">' |
91 | - . str_replace(',', ', ', $value['first']) . '</td><td style="width:40%;">' |
|
92 | - . str_replace(',', ', ', $value['second']) . '</td></tr>'; |
|
93 | - $aString[] = $this->displayTableRow([ |
|
91 | + . str_replace(',', ', ', $value[ 'first' ]) . '</td><td style="width:40%;">' |
|
92 | + . str_replace(',', ', ', $value[ 'second' ]) . '</td></tr>'; |
|
93 | + $aString[ ] = $this->displayTableRow([ |
|
94 | 94 | 'rowContent' => $rowString, |
95 | 95 | 'displayOnlyDifferent' => $displayOnlyDifferent, |
96 | - 'first' => $value['first'], |
|
97 | - 'second' => $value['second'], |
|
96 | + 'first' => $value[ 'first' ], |
|
97 | + 'second' => $value[ 'second' ], |
|
98 | 98 | ]); |
99 | 99 | } |
100 | 100 | return '<tbody>' . implode('', $aString) . '</tbody>'; |
@@ -105,12 +105,12 @@ discard block |
||
105 | 105 | $urlArguments = '?Label=' . $this->superGlobals->get('Label'); |
106 | 106 | return '<thead><tr>' |
107 | 107 | . '<th>Identifier</th>' |
108 | - . '<th><a href="' . $inArray['Servers'][$this->superGlobals->get('localConfig')]['url'] |
|
108 | + . '<th><a href="' . $inArray[ 'Servers' ][ $this->superGlobals->get('localConfig') ][ 'url' ] |
|
109 | 109 | . $urlArguments . '" target="_blank">' |
110 | - . $inArray['Servers'][$this->superGlobals->get('localConfig')]['name'] . '</a></th>' |
|
111 | - . '<th><a href="' . $inArray['Servers'][$this->superGlobals->get('serverConfig')]['url'] |
|
110 | + . $inArray[ 'Servers' ][ $this->superGlobals->get('localConfig') ][ 'name' ] . '</a></th>' |
|
111 | + . '<th><a href="' . $inArray[ 'Servers' ][ $this->superGlobals->get('serverConfig') ][ 'url' ] |
|
112 | 112 | . $urlArguments . '" target="_blank">' |
113 | - . $inArray['Servers'][$this->superGlobals->get('serverConfig')]['name'] . '</a></th>' |
|
113 | + . $inArray[ 'Servers' ][ $this->superGlobals->get('serverConfig') ][ 'name' ] . '</a></th>' |
|
114 | 114 | . '</tr></thead>'; |
115 | 115 | } |
116 | 116 | } |