Completed
Push — master ( 75f49e...484d23 )
by Daniel
02:11
created
source/Compare.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
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,42 +63,42 @@  discard block
 block discarded – undo
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
-        $this->localConfiguration  = ['response' => '', 'info' => ''];
95
-        $this->serverConfiguration = ['response' => '', 'info' => ''];
96
-        if (!is_null($inArray['sGlobals']->get('localConfig')) && !is_null($inArray['sGlobals']->get('serverConfig'))) {
97
-            $urlArguments              = '?Label=' . urlencode($inArray['sGlobals']->get('Label'));
98
-            $source                    = $this->config['Servers'][$inArray['sGlobals']->get('localConfig')]['url']
94
+        $this->localConfiguration  = [ 'response' => '', 'info' => '' ];
95
+        $this->serverConfiguration = [ 'response' => '', 'info' => '' ];
96
+        if (!is_null($inArray[ 'sGlobals' ]->get('localConfig')) && !is_null($inArray[ 'sGlobals' ]->get('serverConfig'))) {
97
+            $urlArguments              = '?Label=' . urlencode($inArray[ 'sGlobals' ]->get('Label'));
98
+            $source                    = $this->config[ 'Servers' ][ $inArray[ 'sGlobals' ]->get('localConfig') ][ 'url' ]
99 99
                     . $urlArguments;
100 100
             $this->localConfiguration  = $this->getContentFromUrlThroughCurlAsArrayIfJson($source);
101
-            $destination               = $this->config['Servers'][$inArray['sGlobals']->get('serverConfig')]['url']
101
+            $destination               = $this->config[ 'Servers' ][ $inArray[ 'sGlobals' ]->get('serverConfig') ][ 'url' ]
102 102
                     . $urlArguments;
103 103
             $this->serverConfiguration = $this->getContentFromUrlThroughCurlAsArrayIfJson($destination);
104 104
         }
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
     {
121 121
         return '<div class="tabbertab" id="tabCurl" title="CURL infos">'
122 122
                 . $this->displayTableFromMultiLevelArray([
123
-                    'source'       => $this->localConfiguration['info'],
124
-                    'destination'  => $this->serverConfiguration['info'],
125
-                    'Servers'      => $this->config['Servers'],
126
-                    'SuperGlobals' => $inArray['SuperGlobals'],
123
+                    'source'       => $this->localConfiguration[ 'info' ],
124
+                    'destination'  => $this->serverConfiguration[ 'info' ],
125
+                    'Servers'      => $this->config[ 'Servers' ],
126
+                    'SuperGlobals' => $inArray[ 'SuperGlobals' ],
127 127
                 ])
128 128
                 . '</div><!--from tabCurl-->';
129 129
     }
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
     private function setFormInfos($inArray)
132 132
     {
133 133
         return '<div class="tabbertab'
134
-                . (is_null($inArray['SuperGlobals']->get('Label')) ? '' : ' tabbertabdefault')
134
+                . (is_null($inArray[ 'SuperGlobals' ]->get('Label')) ? '' : ' tabbertabdefault')
135 135
                 . '" id="tabConfigs" title="Informations">'
136 136
                 . $this->displayTableFromMultiLevelArray([
137
-                    'source'       => $this->localConfiguration['response'],
138
-                    'destination'  => $this->serverConfiguration['response'],
139
-                    'Servers'      => $this->config['Servers'],
140
-                    'SuperGlobals' => $inArray['SuperGlobals'],
137
+                    'source'       => $this->localConfiguration[ 'response' ],
138
+                    'destination'  => $this->serverConfiguration[ 'response' ],
139
+                    'Servers'      => $this->config[ 'Servers' ],
140
+                    'SuperGlobals' => $inArray[ 'SuperGlobals' ],
141 141
                 ])
142 142
                 . '</div><!--from tabConfigs-->';
143 143
     }
Please login to merge, or discard this patch.
source/CompareTable.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -35,15 +35,15 @@  discard block
 block discarded – undo
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
     }
@@ -59,12 +59,12 @@  discard block
 block discarded – undo
59 59
 
60 60
     private function displayTableRow($inArray)
61 61
     {
62
-        $sString = $inArray['rowContent'];
63
-        if ($inArray['displayOnlyDifferent']) {
64
-            if ($inArray['first'] == $inArray['second']) {
62
+        $sString = $inArray[ 'rowContent' ];
63
+        if ($inArray[ 'displayOnlyDifferent' ]) {
64
+            if ($inArray[ 'first' ] == $inArray[ 'second' ]) {
65 65
                 $sString = '';
66
-            } elseif ($inArray['first'] != $inArray['second']) {
67
-                $sString = $inArray['rowContent'];
66
+            } elseif ($inArray[ 'first' ] != $inArray[ 'second' ]) {
67
+                $sString = $inArray[ 'rowContent' ];
68 68
             }
69 69
         }
70 70
         return $sString;
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.