Passed
Pull Request — develop (#92)
by Felipe
06:19
created
src/classes/Highlight.php 1 patch
Spacing   +20 added lines, -23 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         public function __construct()
91 91
         {
92 92
 
93
-            $keyword_replace = function ($keywords, $text, $ncs = false) {
93
+            $keyword_replace = function($keywords, $text, $ncs = false) {
94 94
                 $cm = $ncs ? 'i' : '';
95 95
                 foreach ($keywords as $keyword) {
96 96
                     $search[]  = "/(\\b$keyword\\b)/" . $cm;
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
                 return preg_replace($search, $replace, $text);
104 104
             };
105 105
 
106
-            $preproc_replace = function ($preproc, $text) {
106
+            $preproc_replace = function($preproc, $text) {
107 107
                 foreach ($preproc as $proc) {
108 108
                     $search[]  = "/(\\s*#\s*$proc\\b)/";
109 109
                     $replace[] = '<span class="keyword">\\0</span>';
@@ -112,11 +112,11 @@  discard block
 block discarded – undo
112 112
                 return preg_replace($search, $replace, $text);
113 113
             };
114 114
 
115
-            $sch_syntax_helper = function ($text) {
115
+            $sch_syntax_helper = function($text) {
116 116
                 return $text;
117 117
             };
118 118
 
119
-            $syntax_highlight_helper = function ($text, $language) use ($keyword_replace, $preproc_replace) {
119
+            $syntax_highlight_helper = function($text, $language) use ($keyword_replace, $preproc_replace) {
120 120
                 $preproc        = [];
121 121
                 $preproc['C++'] = [
122 122
                     'if',
@@ -1921,66 +1921,64 @@  discard block
 block discarded – undo
1921 1921
                     'PL/I'   => true,
1922 1922
                     'SQL'    => true,
1923 1923
                 ];
1924
-                $ncs              = false;
1924
+                $ncs = false;
1925 1925
                 if (array_key_exists($language, $case_insensitive)) {
1926 1926
                     $ncs = true;
1927 1927
                 }
1928 1928
 
1929 1929
                 $text = array_key_exists($language, $preproc) ?
1930
-                    $preproc_replace($preproc[$language], $text) :
1931
-                    $text;
1930
+                    $preproc_replace($preproc[$language], $text) : $text;
1932 1931
                 $text = array_key_exists($language, $keywords) ?
1933
-                    $keyword_replace($keywords[$language], $text, $ncs) :
1934
-                    $text;
1932
+                    $keyword_replace($keywords[$language], $text, $ncs) : $text;
1935 1933
 
1936 1934
                 return $text;
1937 1935
             };
1938 1936
 
1939
-            $rtrim1 = function ($span, $lang, $ch) use ($syntax_highlight_helper) {
1937
+            $rtrim1 = function($span, $lang, $ch) use ($syntax_highlight_helper) {
1940 1938
                 return $syntax_highlight_helper(substr($span, 0, -1), $lang);
1941 1939
             };
1942 1940
 
1943
-            $rtrim1_htmlesc = function ($span, $lang, $ch) {
1941
+            $rtrim1_htmlesc = function($span, $lang, $ch) {
1944 1942
                 return htmlspecialchars(substr($span, 0, -1));
1945 1943
             };
1946 1944
 
1947
-            $sch_rtrim1 = function ($span, $lang, $ch) use ($sch_syntax_helper) {
1945
+            $sch_rtrim1 = function($span, $lang, $ch) use ($sch_syntax_helper) {
1948 1946
                 return $sch_syntax_helper(substr($span, 0, -1));
1949 1947
             };
1950 1948
 
1951
-            $rtrim2 = function ($span, $lang, $ch) {
1949
+            $rtrim2 = function($span, $lang, $ch) {
1952 1950
                 return substr($span, 0, -2);
1953 1951
             };
1954 1952
 
1955
-            $syn_proc = function ($span, $lang, $ch) use ($syntax_highlight_helper) {
1953
+            $syn_proc = function($span, $lang, $ch) use ($syntax_highlight_helper) {
1956 1954
                 return $syntax_highlight_helper($span, $lang);
1957 1955
             };
1958 1956
 
1959
-            $dash_putback = function ($span, $lang, $ch) use ($syntax_highlight_helper) {
1957
+            $dash_putback = function($span, $lang, $ch) use ($syntax_highlight_helper) {
1960 1958
                 return $syntax_highlight_helper('-' . $span, $lang);
1961 1959
             };
1962 1960
 
1963
-            $slash_putback = function ($span, $lang, $ch) use ($syntax_highlight_helper) {
1961
+            $slash_putback = function($span, $lang, $ch) use ($syntax_highlight_helper) {
1964 1962
                 return $syntax_highlight_helper('/' . $span, $lang);
1965 1963
             };
1966 1964
 
1967
-            $slash_putback_rtrim1 = function ($span, $lang, $ch) use ($rtrim1) {
1965
+            $slash_putback_rtrim1 = function($span, $lang, $ch) use ($rtrim1) {
1968 1966
                 return $rtrim1('/' . $span, $lang, $ch);
1969 1967
             };
1970 1968
 
1971
-            $lparen_putback = function ($span, $lang, $ch) use ($syntax_highlight_helper) {
1969
+            $lparen_putback = function($span, $lang, $ch) use ($syntax_highlight_helper) {
1972 1970
                 return $syntax_highlight_helper('(' . $span, $lang);
1973 1971
             };
1974 1972
 
1975
-            $lparen_putback_rtrim1 = function ($span, $lang, $ch) use ($rtrim1) {
1973
+            $lparen_putback_rtrim1 = function($span, $lang, $ch) use ($rtrim1) {
1976 1974
                 return $rtrim1('(' . $span, $lang, $ch);
1977 1975
             };
1978 1976
 
1979
-            $prepend_xml_opentag = function ($span, $lang, $ch) {
1977
+            $prepend_xml_opentag = function($span, $lang, $ch) {
1980 1978
                 return '<span class="xml_tag">&lt;' . $span;
1981 1979
             };
1982 1980
 
1983
-            $proc_void = function ($span, $lang, $ch) {
1981
+            $proc_void = function($span, $lang, $ch) {
1984 1982
                 return $span;
1985 1983
             };
1986 1984
 
@@ -2442,8 +2440,7 @@  discard block
 block discarded – undo
2442 2440
 
2443 2441
                 $oldstate = $state;
2444 2442
                 $state    = array_key_exists($ch, $this->states[$language][$state]) ?
2445
-                    $this->states[$language][$state][$ch] :
2446
-                    $this->states[$language][$state][0];
2443
+                    $this->states[$language][$state][$ch] : $this->states[$language][$state][0];
2447 2444
 
2448 2445
                 $span .= $ch;
2449 2446
 
Please login to merge, or discard this patch.
src/database/Postgres83.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -212,7 +212,7 @@
 block discarded – undo
212 212
             $status = -1; // ini
213 213
             if ($rs->recordCount() and ($rs->fields['vacrelid'] == $toid)) {
214 214
                 // table exists in pg_autovacuum, UPDATE
215
-                $sql    = sprintf("UPDATE \"pg_catalog\".\"pg_autovacuum\" SET
215
+                $sql = sprintf("UPDATE \"pg_catalog\".\"pg_autovacuum\" SET
216 216
 						enabled = '%s',
217 217
 						vac_base_thresh = %s,
218 218
 						vac_scale_factor = %s,
Please login to merge, or discard this patch.
src/database/ADOdbBase.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -394,7 +394,7 @@
 block discarded – undo
394 394
         // Pick out array entries by carefully parsing.  This is necessary in order
395 395
         // to cope with double quotes and commas, etc.
396 396
         $elements  = [];
397
-        $i         = $j         = 0;
397
+        $i         = $j = 0;
398 398
         $in_quotes = false;
399 399
         while ($i < strlen($arr)) {
400 400
             // If current char is a double quote and it's not escaped, then
Please login to merge, or discard this patch.
src/database/Postgres.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2075,7 +2075,7 @@
 block discarded – undo
2075 2075
         // Pick out individual ACE's by carefully parsing.  This is necessary in order
2076 2076
         // to cope with usernames and stuff that contain commas
2077 2077
         $aces      = [];
2078
-        $i         = $j         = 0;
2078
+        $i         = $j = 0;
2079 2079
         $in_quotes = false;
2080 2080
         while ($i < strlen($acl)) {
2081 2081
             // If current char is a double quote and it's not escaped, then
Please login to merge, or discard this patch.
src/controllers/TypesController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -248,7 +248,7 @@
 block discarded – undo
248 248
         $this->printTitle($lang['strproperties'], 'pg.type');
249 249
         $this->printMsg($msg);
250 250
 
251
-        $attPre = function (&$rowdata) use ($data) {
251
+        $attPre = function(&$rowdata) use ($data) {
252 252
             $rowdata->fields['+type'] = $data->formatType($rowdata->fields['type'], $rowdata->fields['atttypmod']);
253 253
         };
254 254
 
Please login to merge, or discard this patch.
src/database/Postgres81.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -212,7 +212,7 @@
 block discarded – undo
212 212
             $status = -1; // ini
213 213
             if ($rs->recordCount() and ($rs->fields['vacrelid'] == $toid)) {
214 214
                 // table exists in pg_autovacuum, UPDATE
215
-                $sql    = sprintf("UPDATE \"pg_catalog\".\"pg_autovacuum\" SET
215
+                $sql = sprintf("UPDATE \"pg_catalog\".\"pg_autovacuum\" SET
216 216
 						enabled = '%s',
217 217
 						vac_base_thresh = %s,
218 218
 						vac_scale_factor = %s,
Please login to merge, or discard this patch.
src/controllers/TblpropertiesController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $lang = $this->lang;
99 99
         $data = $misc->getDatabaseAccessor();
100 100
 
101
-        $attPre = function (&$rowdata, $actions) use ($data) {
101
+        $attPre = function(&$rowdata, $actions) use ($data) {
102 102
             $rowdata->fields['+type'] = $data->formatType($rowdata->fields['type'], $rowdata->fields['atttypmod']);
103 103
             $attname                  = $rowdata->fields['attname'];
104 104
             $table                    = $_REQUEST['table'];
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
             return $actions;
112 112
         };
113 113
 
114
-        $cstrRender = function ($s, $p) use ($misc, $data) {
114
+        $cstrRender = function($s, $p) use ($misc, $data) {
115 115
             $str = '';
116 116
             foreach ($p['keys'] as $k => $c) {
117 117
                 if (is_null($p['keys'][$k]['consrc'])) {
Please login to merge, or discard this patch.
src/lib.inc.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
 $container['requestobj']  = $container['request'];
104 104
 $container['responseobj'] = $container['response'];
105 105
 
106
-$container['utils'] = function ($c) {
106
+$container['utils'] = function($c) {
107 107
     $utils = new \PHPPgAdmin\ContainerUtils($c);
108 108
     return $utils;
109 109
 };
110 110
 
111
-$container['conf'] = function ($c) use ($conf) {
111
+$container['conf'] = function($c) use ($conf) {
112 112
 
113 113
     //\Kint::dump($conf);
114 114
     // Plugins are removed
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     return $conf;
118 118
 };
119 119
 
120
-$container['lang'] = function ($c) {
120
+$container['lang'] = function($c) {
121 121
     include_once BASE_PATH . '/src/translations.php';
122 122
 
123 123
     $c['appLangFiles'] = $appLangFiles;
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
     return $lang;
128 128
 };
129 129
 
130
-$container['plugin_manager'] = function ($c) {
130
+$container['plugin_manager'] = function($c) {
131 131
     $plugin_manager = new \PHPPgAdmin\PluginManager($c);
132 132
     return $plugin_manager;
133 133
 };
134 134
 
135
-$container['serializer'] = function ($c) {
135
+$container['serializer'] = function($c) {
136 136
     $serializerbuilder = \JMS\Serializer\SerializerBuilder::create();
137 137
     $serializer        = $serializerbuilder
138 138
         ->setCacheDir(BASE_PATH . '/temp/jms')
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 };
143 143
 
144 144
 // Create Misc class references
145
-$container['misc'] = function ($c) {
145
+$container['misc'] = function($c) {
146 146
     $misc = new \PHPPgAdmin\Misc($c);
147 147
 
148 148
     $conf = $c->get('conf');
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 };
241 241
 
242 242
 // Register Twig View helper
243
-$container['view'] = function ($c) {
243
+$container['view'] = function($c) {
244 244
     $conf = $c->get('conf');
245 245
     $misc = $c->misc;
246 246
 
@@ -276,8 +276,8 @@  discard block
 block discarded – undo
276 276
     return $view;
277 277
 };
278 278
 
279
-$container['haltHandler'] = function ($c) {
280
-    return function ($request, $response, $exits, $status = 500) use ($c) {
279
+$container['haltHandler'] = function($c) {
280
+    return function($request, $response, $exits, $status = 500) use ($c) {
281 281
         $title = 'PHPPgAdmin Error';
282 282
 
283 283
         $html = '<p>The application could not run because of the following error:</p>';
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 
308 308
 // Set the requestobj and responseobj properties of the container
309 309
 // as the value of $request and $response, which already contain the route
310
-$app->add(function ($request, $response, $next) {
310
+$app->add(function($request, $response, $next) {
311 311
     $this['requestobj']  = $request;
312 312
     $this['responseobj'] = $response;
313 313
 
Please login to merge, or discard this patch.
index.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@  discard block
 block discarded – undo
5 5
  */
6 6
 require_once './src/lib.inc.php';
7 7
 
8
-$app->get('/status', function ($request, $response, $args) {
8
+$app->get('/status', function($request, $response, $args) {
9 9
     return $response
10 10
         ->withHeader('Content-type', 'application/json')
11 11
         ->withJson(['version' => $this->version]);
12 12
 });
13 13
 
14
-$app->post('/redirect[/{subject}]', function ($request, $response, $args) {
14
+$app->post('/redirect[/{subject}]', function($request, $response, $args) {
15 15
     $body         = $response->getBody();
16 16
     $query_string = $request->getUri()->getQuery();
17 17
     $misc         = $this->misc;
@@ -56,33 +56,33 @@  discard block
 block discarded – undo
56 56
     }
57 57
 });
58 58
 
59
-$app->get('/redirect[/{subject}]', function ($request, $response, $args) {
59
+$app->get('/redirect[/{subject}]', function($request, $response, $args) {
60 60
     $subject        = (isset($args['subject'])) ? $args['subject'] : 'root';
61 61
     $destinationurl = $this->utils->getDestinationWithLastTab($subject);
62 62
     return $response->withStatus(302)->withHeader('Location', $destinationurl);
63 63
 });
64 64
 
65
-$app->get('/src/views/browser', function ($request, $response, $args) {
65
+$app->get('/src/views/browser', function($request, $response, $args) {
66 66
     $controller = new \PHPPgAdmin\Controller\BrowserController($this, true);
67 67
     return $controller->render();
68 68
 });
69 69
 
70
-$app->get('/src/views/login', function ($request, $response, $args) {
70
+$app->get('/src/views/login', function($request, $response, $args) {
71 71
     $controller = new \PHPPgAdmin\Controller\LoginController($this, true);
72 72
     return $controller->render();
73 73
 });
74 74
 
75
-$app->get('/src/views/servers', function ($request, $response, $args) {
75
+$app->get('/src/views/servers', function($request, $response, $args) {
76 76
     $controller = new \PHPPgAdmin\Controller\ServersController($this, true);
77 77
     return $controller->render();
78 78
 });
79 79
 
80
-$app->get('/src/views/intro', function ($request, $response, $args) {
80
+$app->get('/src/views/intro', function($request, $response, $args) {
81 81
     $controller = new \PHPPgAdmin\Controller\IntroController($this, true);
82 82
     return $controller->render();
83 83
 });
84 84
 
85
-$app->map(['GET', 'POST'], '/src/views/{subject}', function ($request, $response, $args) {
85
+$app->map(['GET', 'POST'], '/src/views/{subject}', function($request, $response, $args) {
86 86
     if ($this->misc->getServerId() === null) {
87 87
         return $response->withStatus(302)->withHeader('Location', SUBFOLDER . '/src/views/servers');
88 88
     }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     return $controller->render();
101 101
 });
102 102
 
103
-$app->get('/[{subject}]', function ($request, $response, $args) {
103
+$app->get('/[{subject}]', function($request, $response, $args) {
104 104
     $subject      = (isset($args['subject'])) ? $args['subject'] : 'intro';
105 105
     $_server_info = $this->misc->getServerInfo();
106 106
     $query_string = $request->getUri()->getQuery();
Please login to merge, or discard this patch.