Passed
Push — master ( fc9574...c1ae29 )
by Goffy
03:21
created
class/ReleasesHandler.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
                 if (Constants::STATUS_NEW === $repoStatus || Constants::STATUS_UPDATED === $repoStatus || 0 == $releasesCount) {
150 150
                     $ghReleases = $githubClient->getReleases($repositoriesAll[$i]->getVar('repo_user'), $repositoriesAll[$i]->getVar('repo_name'));
151 151
                     if ($releasesCount > 0) {
152
-                        $sql = 'DELETE FROM `' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '` WHERE `rel_repoid` = ' . $repoId;
152
+                        $sql = 'DELETE FROM `'.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'` WHERE `rel_repoid` = '.$repoId;
153 153
                         if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) {
154 154
                             return false;
155 155
                         }
@@ -159,13 +159,13 @@  discard block
 block discarded – undo
159 159
                 $first = true;
160 160
                 $final = false;
161 161
                 foreach ($ghReleases as $ghRelease) {
162
-                    if ($first || (!$final && !(bool)$ghRelease['prerelease'])) {
162
+                    if ($first || (!$final && !(bool) $ghRelease['prerelease'])) {
163 163
                         // save first in any case and save first final version
164 164
                         $releasesObj = $releasesHandler->create();
165 165
                         $releasesObj->setVar('rel_repoid', $repoId);
166 166
                         $releasesObj->setVar('rel_type', $ghRelease['type']);
167 167
                         $releasesObj->setVar('rel_name', $ghRelease['name']);
168
-                        $releasesObj->setVar('rel_prerelease', (true == (bool)$ghRelease['prerelease']));
168
+                        $releasesObj->setVar('rel_prerelease', (true == (bool) $ghRelease['prerelease']));
169 169
                         $releasesObj->setVar('rel_publishedat', \strtotime($ghRelease['published_at']));
170 170
                         $releasesObj->setVar('rel_tarballurl', $ghRelease['tarball_url']);
171 171
                         $releasesObj->setVar('rel_zipballurl', $ghRelease['zipball_url']);
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
                         }
178 178
                     }
179 179
                     $first = false;
180
-                    if (false === (bool)$ghRelease['prerelease']) {
180
+                    if (false === (bool) $ghRelease['prerelease']) {
181 181
                         $final = true;
182 182
                     }
183 183
                 }
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
                 // must return true otherwise releases will not be loaded
216 216
                 return true;
217 217
             }
218
-            $sql = 'DELETE FROM `' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '` WHERE `rel_repoid` = ' . $repoId;
218
+            $sql = 'DELETE FROM `'.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'` WHERE `rel_repoid` = '.$repoId;
219 219
             if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) {
220 220
                 return false;
221 221
             }
@@ -224,13 +224,13 @@  discard block
 block discarded – undo
224 224
             $first = true;
225 225
             $final = false;
226 226
             foreach ($ghReleases as $ghRelease) {
227
-                if ($first || (!$final && !(bool)$ghRelease['prerelease'])) {
227
+                if ($first || (!$final && !(bool) $ghRelease['prerelease'])) {
228 228
                     // save first in any case and save first final version
229 229
                     $releasesObj = $releasesHandler->create();
230 230
                     $releasesObj->setVar('rel_repoid', $repoId);
231 231
                     //$releasesObj->setVar('rel_type', $ghRelease['type']);
232 232
                     $releasesObj->setVar('rel_name', $ghRelease['name']);
233
-                    $releasesObj->setVar('rel_prerelease', (true == (bool)$ghRelease['prerelease']));
233
+                    $releasesObj->setVar('rel_prerelease', (true == (bool) $ghRelease['prerelease']));
234 234
                     $releasesObj->setVar('rel_publishedat', \strtotime($ghRelease['published_at']));
235 235
                     $releasesObj->setVar('rel_tarballurl', $ghRelease['tarball_url']);
236 236
                     $releasesObj->setVar('rel_zipballurl', $ghRelease['zipball_url']);
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
                     }
243 243
                 }
244 244
                 $first = false;
245
-                if (false === (bool)$ghRelease['prerelease']) {
245
+                if (false === (bool) $ghRelease['prerelease']) {
246 246
                     $final = true;
247 247
                 }
248 248
             }
@@ -259,17 +259,17 @@  discard block
 block discarded – undo
259 259
     public function updateRepoReleases()
260 260
     {
261 261
         // update repo_prerelease
262
-        $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . ' INNER JOIN ' . $GLOBALS['xoopsDB']->prefix('wggithub_releases');
263
-        $sql .= ' ON ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . '.repo_id = ' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '.rel_repoid ';
264
-        $sql .= 'SET ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . '.repo_prerelease = 1 ';
265
-        $sql .= 'WHERE (((' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '.rel_prerelease)=1));';
262
+        $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').' INNER JOIN '.$GLOBALS['xoopsDB']->prefix('wggithub_releases');
263
+        $sql .= ' ON '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').'.repo_id = '.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'.rel_repoid ';
264
+        $sql .= 'SET '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').'.repo_prerelease = 1 ';
265
+        $sql .= 'WHERE ((('.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'.rel_prerelease)=1));';
266 266
         $GLOBALS['xoopsDB']->queryF($sql);
267 267
 
268 268
         // update repo_release
269
-        $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . ' INNER JOIN ' . $GLOBALS['xoopsDB']->prefix('wggithub_releases');
270
-        $sql .= ' ON ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . '.repo_id = ' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '.rel_repoid ';
271
-        $sql .= 'SET ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . '.repo_release = 1 ';
272
-        $sql .= 'WHERE (((' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '.rel_prerelease)=0));';
269
+        $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').' INNER JOIN '.$GLOBALS['xoopsDB']->prefix('wggithub_releases');
270
+        $sql .= ' ON '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').'.repo_id = '.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'.rel_repoid ';
271
+        $sql .= 'SET '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').'.repo_release = 1 ';
272
+        $sql .= 'WHERE ((('.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'.rel_prerelease)=0));';
273 273
         $GLOBALS['xoopsDB']->queryF($sql);
274 274
 
275 275
         return true;
Please login to merge, or discard this patch.