Passed
Push — master ( 86de2c...0deb8f )
by Goffy
03:37
created
class/Common/Breadcrumb.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
         require $GLOBALS['xoops']->path('class/template.php');
74 74
         $breadcrumbTpl = new \XoopsTpl();
75 75
         $breadcrumbTpl->assign('breadcrumb', $this->bread);
76
-        $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl');
76
+        $html = $breadcrumbTpl->fetch('db:'.$this->dirname.'_common_breadcrumb.tpl');
77 77
         unset($breadcrumbTpl);
78 78
 
79 79
         return $html;
Please login to merge, or discard this patch.
class/Common/Resizer.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,8 +65,8 @@
 block discarded – undo
65 65
 
66 66
         if ($width > $this->maxWidth || $height > $this->maxHeight) {
67 67
             // recalc image size based on this->maxWidth/this->maxHeight
68
-			$new_width  = 0;
69
-			$new_height = 0;
68
+            $new_width  = 0;
69
+            $new_height = 0;
70 70
             if ($width > $height) {
71 71
                 if ($width < $this->maxWidth) {
72 72
                     $new_width = $width;
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -146,14 +146,14 @@  discard block
 block discarded – undo
146 146
         $max_height_resize = $this->maxHeight;
147 147
         if ($original_w > $original_h) {
148 148
             $max_height_ratio = $this->maxHeight / $original_h;
149
-            $max_width_resize = (int)\round($original_w * $max_height_ratio);
149
+            $max_width_resize = (int) \round($original_w * $max_height_ratio);
150 150
         } else {
151 151
             $max_width_ratio   = $this->maxWidth / $original_w;
152
-            $max_height_resize = (int)\round($original_h * $max_width_ratio);
152
+            $max_height_resize = (int) \round($original_h * $max_width_ratio);
153 153
         }
154 154
         if ($max_width_resize < $this->maxWidth) {
155 155
             $max_height_ratio  = $this->maxWidth / $max_width_resize;
156
-            $max_height_resize = (int)\round($this->maxHeight * $max_height_ratio);
156
+            $max_height_resize = (int) \round($this->maxHeight * $max_height_ratio);
157 157
             $max_width_resize  = $this->maxWidth;
158 158
         }
159 159
 
@@ -168,9 +168,9 @@  discard block
 block discarded – undo
168 168
         $max_width_offset  = 0;
169 169
         $max_height_offset = 0;
170 170
         if ($this->maxWidth < $max_width_resize) {
171
-            $max_width_offset = (int)\round(($max_width_resize - $this->maxWidth) / 2);
171
+            $max_width_offset = (int) \round(($max_width_resize - $this->maxWidth) / 2);
172 172
         } else {
173
-            $max_height_offset = (int)\round(($max_height_resize - $this->maxHeight) / 2);
173
+            $max_height_offset = (int) \round(($max_height_resize - $this->maxHeight) / 2);
174 174
         }
175 175
 
176 176
         if (!imagecopy($final, $thumb, 0, 0, $max_width_offset, $max_height_offset, $max_width_resize, $max_height_resize)) {
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
         $dest = \imagecreatefromjpeg($this->endFile);
190 190
         $src  = \imagecreatefromjpeg($this->sourceFile);
191 191
         if (4 == $this->mergeType) {
192
-            $imgWidth  = (int)\round($this->maxWidth / 2 - 1);
193
-            $imgHeight = (int)\round($this->maxHeight / 2 - 1);
194
-            $posCol2   = (int)\round($this->maxWidth / 2 + 1);
195
-            $posRow2   = (int)\round($this->maxHeight / 2 + 1);
192
+            $imgWidth  = (int) \round($this->maxWidth / 2 - 1);
193
+            $imgHeight = (int) \round($this->maxHeight / 2 - 1);
194
+            $posCol2   = (int) \round($this->maxWidth / 2 + 1);
195
+            $posRow2   = (int) \round($this->maxHeight / 2 + 1);
196 196
             switch ($this->mergePos) {
197 197
                 case 1:
198 198
                     imagecopy($dest, $src, 0, 0, 0, 0, $imgWidth, $imgHeight); //top left
@@ -209,11 +209,11 @@  discard block
 block discarded – undo
209 209
             }
210 210
         }
211 211
         if (6 == $this->mergeType) {
212
-            $imgWidth  = (int)\round($this->maxWidth / 3 - 1);
213
-            $imgHeight = (int)\round($this->maxHeight / 2 - 1);
214
-            $posCol2   = (int)\round($this->maxWidth / 3 + 1);
215
-            $posCol3   = $posCol2 + (int)\round($this->maxWidth / 3 + 1);
216
-            $posRow2   = (int)\round($this->maxHeight / 2 + 1);
212
+            $imgWidth  = (int) \round($this->maxWidth / 3 - 1);
213
+            $imgHeight = (int) \round($this->maxHeight / 2 - 1);
214
+            $posCol2   = (int) \round($this->maxWidth / 3 + 1);
215
+            $posCol3   = $posCol2 + (int) \round($this->maxWidth / 3 + 1);
216
+            $posRow2   = (int) \round($this->maxHeight / 2 + 1);
217 217
 
218 218
             switch ($this->mergePos) {
219 219
                 case 1:
Please login to merge, or discard this patch.
class/Common/Migrate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@
 block discarded – undo
88 88
                 $this->synchronizeTable($tableName);
89 89
                 $updateTable = $GLOBALS['xoopsDB']->prefix($tableName);
90 90
                 $joinTable   = $GLOBALS['xoopsDB']->prefix($srcTableName);
91
-                $sql         = "UPDATE `$updateTable` t1 INNER JOIN `$joinTable` t2 ON t1.post_id = t2.post_id \n" . "SET t1.dohtml = t2.dohtml,  t1.dosmiley = t2.dosmiley, t1.doxcode = t2.doxcode\n" . '  , t1.doimage = t2.doimage, t1.dobr = t2.dobr';
91
+                $sql         = "UPDATE `$updateTable` t1 INNER JOIN `$joinTable` t2 ON t1.post_id = t2.post_id \n"."SET t1.dohtml = t2.dohtml,  t1.dosmiley = t2.dosmiley, t1.doxcode = t2.doxcode\n".'  , t1.doimage = t2.doimage, t1.dobr = t2.dobr';
92 92
                 $this->tableHandler->addToQueue($sql);
93 93
             }
94 94
         }
Please login to merge, or discard this patch.
class/Common/Configurator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
         //        require \dirname(\dirname(__DIR__)) . '/config/config.php';
52 52
         //        $config = getConfig();
53 53
 
54
-        $config = include dirname(__DIR__, 2) . '/config/config.php';
54
+        $config = include dirname(__DIR__, 2).'/config/config.php';
55 55
 
56 56
         $this->name            = $config->name;
57 57
         $this->paths           = $config->paths;
Please login to merge, or discard this patch.
class/Common/ModuleFeedback.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -67,29 +67,29 @@  discard block
 block discarded – undo
67 67
         $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
68 68
         // Get Theme Form
69 69
         \xoops_load('XoopsFormLoader');
70
-        $form = new \XoopsThemeForm(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_FORM_TITLE'), 'formfeedback', 'feedback.php', 'post', true);
70
+        $form = new \XoopsThemeForm(\constant('CO_'.$moduleDirNameUpper.'_'.'FB_FORM_TITLE'), 'formfeedback', 'feedback.php', 'post', true);
71 71
         $form->setExtra('enctype="multipart/form-data"');
72 72
 
73
-        $recipient = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_RECIPIENT'), 'recipient', 50, 255, $GLOBALS['xoopsModule']->getInfo('author_mail'));
73
+        $recipient = new \XoopsFormText(\constant('CO_'.$moduleDirNameUpper.'_'.'FB_RECIPIENT'), 'recipient', 50, 255, $GLOBALS['xoopsModule']->getInfo('author_mail'));
74 74
         $recipient->setExtra('disabled="disabled"');
75 75
         $form->addElement($recipient);
76
-        $your_name = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME'), 'your_name', 50, 255, $this->name);
77
-        $your_name->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME_PLACEHOLER') . '"');
76
+        $your_name = new \XoopsFormText(\constant('CO_'.$moduleDirNameUpper.'_'.'FB_NAME'), 'your_name', 50, 255, $this->name);
77
+        $your_name->setExtra('placeholder="'.\constant('CO_'.$moduleDirNameUpper.'_'.'FB_NAME_PLACEHOLER').'"');
78 78
         $form->addElement($your_name);
79
-        $your_site = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE'), 'your_site', 50, 255, $this->site);
80
-        $your_site->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE_PLACEHOLER') . '"');
79
+        $your_site = new \XoopsFormText(\constant('CO_'.$moduleDirNameUpper.'_'.'FB_SITE'), 'your_site', 50, 255, $this->site);
80
+        $your_site->setExtra('placeholder="'.\constant('CO_'.$moduleDirNameUpper.'_'.'FB_SITE_PLACEHOLER').'"');
81 81
         $form->addElement($your_site);
82
-        $your_mail = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL'), 'your_mail', 50, 255, $this->email);
83
-        $your_mail->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL_PLACEHOLER') . '"');
82
+        $your_mail = new \XoopsFormText(\constant('CO_'.$moduleDirNameUpper.'_'.'FB_MAIL'), 'your_mail', 50, 255, $this->email);
83
+        $your_mail->setExtra('placeholder="'.\constant('CO_'.$moduleDirNameUpper.'_'.'FB_MAIL_PLACEHOLER').'"');
84 84
         $form->addElement($your_mail);
85 85
 
86
-        $fbtypeSelect = new \XoopsFormSelect(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE'), 'fb_type', $this->type);
86
+        $fbtypeSelect = new \XoopsFormSelect(\constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE'), 'fb_type', $this->type);
87 87
         $fbtypeSelect->addOption('', '');
88
-        $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_SUGGESTION'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_SUGGESTION'));
89
-        $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_BUGS'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_BUGS'));
90
-        $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_TESTIMONIAL'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_TESTIMONIAL'));
91
-        $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES'));
92
-        $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS'));
88
+        $fbtypeSelect->addOption(\constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE_SUGGESTION'), \constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE_SUGGESTION'));
89
+        $fbtypeSelect->addOption(\constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE_BUGS'), \constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE_BUGS'));
90
+        $fbtypeSelect->addOption(\constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE_TESTIMONIAL'), \constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE_TESTIMONIAL'));
91
+        $fbtypeSelect->addOption(\constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE_FEATURES'), \constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE_FEATURES'));
92
+        $fbtypeSelect->addOption(\constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE_OTHERS'), \constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE_OTHERS'));
93 93
         $form->addElement($fbtypeSelect, true);
94 94
 
95 95
         $editorConfigs           = [];
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         $configHandler           = \xoops_getHandler('config');
105 105
         $config                  = &$configHandler->getConfigsByCat(0, $module->getVar('mid'));
106 106
         $editorConfigs['editor'] = $config['general_editor'];
107
-        $editor                  = new \XoopsFormEditor(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_CONTENT'), 'fb_content', $editorConfigs);
107
+        $editor                  = new \XoopsFormEditor(\constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE_CONTENT'), 'fb_content', $editorConfigs);
108 108
         $form->addElement($editor, true);
109 109
 
110 110
         $form->addElement(new \XoopsFormHidden('op', 'send'));
Please login to merge, or discard this patch.
class/Common/FilesManagement.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
                     throw new \RuntimeException(\sprintf('Unable to create the %s directory', $folder));
36 36
                 }
37 37
 
38
-                file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>');
38
+                file_put_contents($folder.'/index.html', '<script>history.go(-1);</script>');
39 39
             }
40 40
         } catch (\Exception $e) {
41 41
             echo 'Caught exception: ', $e->getMessage(), '<br>';
@@ -61,14 +61,14 @@  discard block
 block discarded – undo
61 61
         $dir = \opendir($src);
62 62
         //        @\mkdir($dst);
63 63
         if (!@\mkdir($dst) && !\is_dir($dst)) {
64
-            throw new \RuntimeException('The directory ' . $dst . ' could not be created.');
64
+            throw new \RuntimeException('The directory '.$dst.' could not be created.');
65 65
         }
66 66
         while (false !== ($file = \readdir($dir))) {
67 67
             if (('.' !== $file) && ('..' !== $file)) {
68
-                if (\is_dir($src . '/' . $file)) {
69
-                    self::recurseCopy($src . '/' . $file, $dst . '/' . $file);
68
+                if (\is_dir($src.'/'.$file)) {
69
+                    self::recurseCopy($src.'/'.$file, $dst.'/'.$file);
70 70
                 } else {
71
-                    \copy($src . '/' . $file, $dst . '/' . $file);
71
+                    \copy($src.'/'.$file, $dst.'/'.$file);
72 72
                 }
73 73
             }
74 74
         }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
                 self::rrmdir($fObj->getPathname());
208 208
             }
209 209
         }
210
-        $iterator = null;   // clear iterator Obj to close file/directory
210
+        $iterator = null; // clear iterator Obj to close file/directory
211 211
         return \rmdir($src); // remove the directory & return results
212 212
     }
213 213
 
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
         $iterator = new \DirectoryIterator($src);
241 241
         foreach ($iterator as $fObj) {
242 242
             if ($fObj->isFile()) {
243
-                \rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
243
+                \rename($fObj->getPathname(), "{$dest}/".$fObj->getFilename());
244 244
             } elseif (!$fObj->isDot() && $fObj->isDir()) {
245 245
                 // Try recursively on directory
246
-                self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
246
+                self::rmove($fObj->getPathname(), "{$dest}/".$fObj->getFilename());
247 247
                 //                \rmdir($fObj->getPath()); // now delete the directory
248 248
             }
249 249
         }
250
-        $iterator = null;   // clear iterator Obj to close file/directory
250
+        $iterator = null; // clear iterator Obj to close file/directory
251 251
         return \rmdir($src); // remove the directory & return results
252 252
     }
253 253
 
@@ -283,9 +283,9 @@  discard block
 block discarded – undo
283 283
         $iterator = new \DirectoryIterator($src);
284 284
         foreach ($iterator as $fObj) {
285 285
             if ($fObj->isFile()) {
286
-                \copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
286
+                \copy($fObj->getPathname(), "{$dest}/".$fObj->getFilename());
287 287
             } elseif (!$fObj->isDot() && $fObj->isDir()) {
288
-                self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
288
+                self::rcopy($fObj->getPathname(), "{$dest}/".$fObj->getFilename());
289 289
             }
290 290
         }
291 291
 
Please login to merge, or discard this patch.
class/Common/VersionChecks.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
         //check for minimum XOOPS version
41 41
         $currentVer = mb_substr(XOOPS_VERSION, 6); // get the numeric part of string
42 42
         if (null === $requiredVer) {
43
-            $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string
43
+            $requiredVer = ''.$module->getInfo('min_xoops'); //making sure it's a string
44 44
         }
45 45
         $success = true;
46 46
 
47 47
         if (\version_compare($currentVer, $requiredVer, '<')) {
48 48
             $success = false;
49
-            $module->setErrors(\sprintf(\constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer));
49
+            $module->setErrors(\sprintf(\constant('CO_'.$moduleDirNameUpper.'_ERROR_BAD_XOOPS'), $requiredVer, $currentVer));
50 50
         }
51 51
 
52 52
         return $success;
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 
76 76
         if (false !== $reqVer && '' !== $reqVer) {
77 77
             if (\version_compare($verNum, $reqVer, '<')) {
78
-                $module->setErrors(\sprintf(\constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum));
78
+                $module->setErrors(\sprintf(\constant('CO_'.$moduleDirNameUpper.'_ERROR_BAD_PHP'), $reqVer, $verNum));
79 79
                 $success = false;
80 80
             }
81 81
         }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         $moduleDirName      = \basename(dirname(__DIR__, 2));
98 98
         $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
99 99
         $update             = '';
100
-        $repository         = 'XoopsModules25x/' . $moduleDirName;
100
+        $repository         = 'XoopsModules25x/'.$moduleDirName;
101 101
         //        $repository         = 'XoopsModules25x/publisher'; //for testing only
102 102
         $ret             = '';
103 103
         $infoReleasesUrl = "https://api.github.com/repos/$repository/releases";
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
                 if (false === $curlReturn) {
112 112
                     \trigger_error(\curl_error($curlHandle));
113 113
                 } elseif (mb_strpos($curlReturn, 'Not Found')) {
114
-                    \trigger_error('Repository Not Found: ' . $infoReleasesUrl);
114
+                    \trigger_error('Repository Not Found: '.$infoReleasesUrl);
115 115
                 } else {
116 116
                     $file              = \json_decode($curlReturn, false);
117 117
                     $latestVersionLink = \sprintf("https://github.com/$repository/archive/%s.zip", $file ? reset($file)->tag_name : $default);
118 118
                     $latestVersion     = $file[0]->tag_name;
119 119
                     $prerelease        = $file[0]->prerelease;
120 120
                     if ('master' !== $latestVersionLink) {
121
-                        $update = \constant('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION') . $latestVersion;
121
+                        $update = \constant('CO_'.$moduleDirNameUpper.'_'.'NEW_VERSION').$latestVersion;
122 122
                     }
123 123
                     //"PHP-standardized" version
124 124
                     $latestVersion = \mb_strtolower($latestVersion);
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
                         $latestVersion = \str_replace('_', '', \mb_strtolower($latestVersion));
127 127
                         $latestVersion = \str_replace('final', '', \mb_strtolower($latestVersion));
128 128
                     }
129
-                    $moduleVersion = ($helper->getModule()->getInfo('version') . '_' . $helper->getModule()->getInfo('module_status'));
129
+                    $moduleVersion = ($helper->getModule()->getInfo('version').'_'.$helper->getModule()->getInfo('module_status'));
130 130
                     //"PHP-standardized" version
131 131
                     $moduleVersion = \str_replace(' ', '', \mb_strtolower($moduleVersion));
132 132
                     //                    $moduleVersion = '1.0'; //for testing only
Please login to merge, or discard this patch.
class/RequestsHandler.php 2 patches
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -31,96 +31,96 @@
 block discarded – undo
31 31
  */
32 32
 class RequestsHandler extends \XoopsPersistableObjectHandler
33 33
 {
34
-	/**
35
-	 * Constructor
36
-	 *
37
-	 * @param \XoopsDatabase $db
38
-	 */
39
-	public function __construct(\XoopsDatabase $db)
40
-	{
41
-		parent::__construct($db, 'wggithub_requests', Requests::class, 'req_id', 'req_request');
42
-	}
43
-
44
-	/**
45
-	 * @param bool $isNew
46
-	 *
47
-	 * @return object
48
-	 */
49
-	public function create($isNew = true)
50
-	{
51
-		return parent::create($isNew);
52
-	}
53
-
54
-	/**
55
-	 * retrieve a field
56
-	 *
57
-	 * @param int $i field id
58
-	 * @param null fields
59
-	 * @return mixed reference to the {@link Get} object
60
-	 */
61
-	public function get($i = null, $fields = null)
62
-	{
63
-		return parent::get($i, $fields);
64
-	}
65
-
66
-	/**
67
-	 * get inserted id
68
-	 *
69
-	 * @param null
70
-	 * @return int reference to the {@link Get} object
71
-	 */
72
-	public function getInsertId()
73
-	{
74
-		return $this->db->getInsertId();
75
-	}
76
-
77
-	/**
78
-	 * Get Count Requests in the database
79
-	 * @param int    $start
80
-	 * @param int    $limit
81
-	 * @param string $sort
82
-	 * @param string $order
83
-	 * @return int
84
-	 */
85
-	public function getCountRequests($start = 0, $limit = 0, $sort = 'req_id ASC, req_request', $order = 'ASC')
86
-	{
87
-		$crCountRequests = new \CriteriaCompo();
88
-		$crCountRequests = $this->getRequestsCriteria($crCountRequests, $start, $limit, $sort, $order);
89
-		return $this->getCount($crCountRequests);
90
-	}
91
-
92
-	/**
93
-	 * Get All Requests in the database
94
-	 * @param int    $start
95
-	 * @param int    $limit
96
-	 * @param string $sort
97
-	 * @param string $order
98
-	 * @return array
99
-	 */
100
-	public function getAllRequests($start = 0, $limit = 0, $sort = 'req_id ASC, req_request', $order = 'ASC')
101
-	{
102
-		$crAllRequests = new \CriteriaCompo();
103
-		$crAllRequests = $this->getRequestsCriteria($crAllRequests, $start, $limit, $sort, $order);
104
-		return $this->getAll($crAllRequests);
105
-	}
106
-
107
-	/**
108
-	 * Get Criteria Requests
109
-	 * @param        $crRequests
110
-	 * @param int    $start
111
-	 * @param int    $limit
112
-	 * @param string $sort
113
-	 * @param string $order
114
-	 * @return int
115
-	 */
116
-	private function getRequestsCriteria($crRequests, $start, $limit, $sort, $order)
117
-	{
118
-		$crRequests->setStart($start);
119
-		$crRequests->setLimit($limit);
120
-		$crRequests->setSort($sort);
121
-		$crRequests->setOrder($order);
122
-		return $crRequests;
123
-	}
34
+    /**
35
+     * Constructor
36
+     *
37
+     * @param \XoopsDatabase $db
38
+     */
39
+    public function __construct(\XoopsDatabase $db)
40
+    {
41
+        parent::__construct($db, 'wggithub_requests', Requests::class, 'req_id', 'req_request');
42
+    }
43
+
44
+    /**
45
+     * @param bool $isNew
46
+     *
47
+     * @return object
48
+     */
49
+    public function create($isNew = true)
50
+    {
51
+        return parent::create($isNew);
52
+    }
53
+
54
+    /**
55
+     * retrieve a field
56
+     *
57
+     * @param int $i field id
58
+     * @param null fields
59
+     * @return mixed reference to the {@link Get} object
60
+     */
61
+    public function get($i = null, $fields = null)
62
+    {
63
+        return parent::get($i, $fields);
64
+    }
65
+
66
+    /**
67
+     * get inserted id
68
+     *
69
+     * @param null
70
+     * @return int reference to the {@link Get} object
71
+     */
72
+    public function getInsertId()
73
+    {
74
+        return $this->db->getInsertId();
75
+    }
76
+
77
+    /**
78
+     * Get Count Requests in the database
79
+     * @param int    $start
80
+     * @param int    $limit
81
+     * @param string $sort
82
+     * @param string $order
83
+     * @return int
84
+     */
85
+    public function getCountRequests($start = 0, $limit = 0, $sort = 'req_id ASC, req_request', $order = 'ASC')
86
+    {
87
+        $crCountRequests = new \CriteriaCompo();
88
+        $crCountRequests = $this->getRequestsCriteria($crCountRequests, $start, $limit, $sort, $order);
89
+        return $this->getCount($crCountRequests);
90
+    }
91
+
92
+    /**
93
+     * Get All Requests in the database
94
+     * @param int    $start
95
+     * @param int    $limit
96
+     * @param string $sort
97
+     * @param string $order
98
+     * @return array
99
+     */
100
+    public function getAllRequests($start = 0, $limit = 0, $sort = 'req_id ASC, req_request', $order = 'ASC')
101
+    {
102
+        $crAllRequests = new \CriteriaCompo();
103
+        $crAllRequests = $this->getRequestsCriteria($crAllRequests, $start, $limit, $sort, $order);
104
+        return $this->getAll($crAllRequests);
105
+    }
106
+
107
+    /**
108
+     * Get Criteria Requests
109
+     * @param        $crRequests
110
+     * @param int    $start
111
+     * @param int    $limit
112
+     * @param string $sort
113
+     * @param string $order
114
+     * @return int
115
+     */
116
+    private function getRequestsCriteria($crRequests, $start, $limit, $sort, $order)
117
+    {
118
+        $crRequests->setStart($start);
119
+        $crRequests->setLimit($limit);
120
+        $crRequests->setSort($sort);
121
+        $crRequests->setOrder($order);
122
+        return $crRequests;
123
+    }
124 124
 
125 125
     /**
126 126
      * Update table requests
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@
 block discarded – undo
140 140
         $requestsObj = $requestsHandler->create();
141 141
         $requestsObj->setVar('req_request', $request);
142 142
         $requestsObj->setVar('req_result', $result);
143
-        $requestsObj->setVar('req_datecreated',time());
143
+        $requestsObj->setVar('req_datecreated', time());
144 144
         $requestsObj->setVar('req_submitter', $submitter);
145 145
         // Insert Data
146 146
         if ($requestsHandler->insert($requestsObj)) {
Please login to merge, or discard this patch.
class/Github/GithubClient.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
         $ch = \curl_init();
46 46
         //set the url, number of POST vars, POST data
47 47
         \curl_setopt($ch, \CURLOPT_URL, $url);
48
-        \curl_setopt($ch, \CURLOPT_HTTPAUTH, 'token ' . $this->tokenAuth);
49
-        \curl_setopt($ch, \CURLOPT_USERPWD, $this->userAuth . ':' . $this->tokenAuth);
48
+        \curl_setopt($ch, \CURLOPT_HTTPAUTH, 'token '.$this->tokenAuth);
49
+        \curl_setopt($ch, \CURLOPT_USERPWD, $this->userAuth.':'.$this->tokenAuth);
50 50
         \curl_setopt($ch, \CURLOPT_CUSTOMREQUEST, 'GET');
51 51
         \curl_setopt($ch, \CURLOPT_RETURNTRANSFER, true);
52 52
         \curl_setopt($ch, \CURLOPT_CONNECTTIMEOUT, 25);
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         \curl_setopt($ch, \CURLOPT_POST, 1);
61 61
         $result = \curl_exec($ch);
62 62
         $info = \curl_getinfo($ch);
63
-        if (($errMsg = \curl_error($ch)) || !\in_array((int)$info['http_code'], [200, 201], true)) {
63
+        if (($errMsg = \curl_error($ch)) || !\in_array((int) $info['http_code'], [200, 201], true)) {
64 64
             $error = $throwError;
65 65
         }
66 66
         \curl_close($ch);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         if ($requestsHandler->insert($requestsObj, true)) {
79 79
             $reqId = $requestsObj->getNewInsertedIdRequests();
80 80
         } else {
81
-            throw new \RuntimeException('"' . \_MA_WGGITHUB_READGH_ERROR_INSERTREQ . '"');
81
+            throw new \RuntimeException('"'.\_MA_WGGITHUB_READGH_ERROR_INSERTREQ.'"');
82 82
         }
83 83
         unset($requestsObj);
84 84
 
@@ -90,19 +90,19 @@  discard block
 block discarded – undo
90 90
             $requestsObj = $requestsHandler->get($reqId);
91 91
             $requestsObj->setVar('req_result', $result);
92 92
             if (!$requestsHandler->insert($requestsObj, true)) {
93
-                throw new \RuntimeException('"' . \_MA_WGGITHUB_READGH_ERROR_INSERTREQ . '"');
93
+                throw new \RuntimeException('"'.\_MA_WGGITHUB_READGH_ERROR_INSERTREQ.'"');
94 94
             }
95 95
             unset($requestsObj);
96 96
 
97 97
             if ($this->debug) {
98
-                echo '<br>Error:' . $result;
98
+                echo '<br>Error:'.$result;
99 99
             }
100 100
 
101 101
             //catch common errors
102
-            switch ((int)$info['http_code']) {
102
+            switch ((int) $info['http_code']) {
103 103
                 case 401:
104 104
                     $this->apiErrorMisc = true;
105
-                    throw new \RuntimeException('"' . \_MA_WGGITHUB_READGH_ERROR_API_401 . '"');
105
+                    throw new \RuntimeException('"'.\_MA_WGGITHUB_READGH_ERROR_API_401.'"');
106 106
                     break;
107 107
                 case 403:
108 108
                     if (\strpos($result, 'API rate limit exceeded') > 0) {
@@ -111,21 +111,21 @@  discard block
 block discarded – undo
111 111
                         return false;
112 112
                     } else {
113 113
                         $this->apiErrorMisc = true;
114
-                        throw new \RuntimeException('"' . \_MA_WGGITHUB_READGH_ERROR_API_403 . '"');
114
+                        throw new \RuntimeException('"'.\_MA_WGGITHUB_READGH_ERROR_API_403.'"');
115 115
                     }
116 116
                     break;
117 117
                 case 404:
118 118
                     $this->apiErrorMisc = true;
119
-                    throw new \RuntimeException('"' . \_MA_WGGITHUB_READGH_ERROR_API_404 . '"');
119
+                    throw new \RuntimeException('"'.\_MA_WGGITHUB_READGH_ERROR_API_404.'"');
120 120
                     break;
121 121
                 case 405:
122 122
                     $this->apiErrorMisc = true;
123
-                    throw new \RuntimeException('"' . \_MA_WGGITHUB_READGH_ERROR_API_405 . '"');
123
+                    throw new \RuntimeException('"'.\_MA_WGGITHUB_READGH_ERROR_API_405.'"');
124 124
                     break;
125 125
                 case 0:
126 126
                 default:
127 127
                     $this->apiErrorMisc = true;
128
-                    throw new \RuntimeException('"' . \_MA_WGGITHUB_READGH_ERROR_API . ': ' . $errMsg . '"');
128
+                    throw new \RuntimeException('"'.\_MA_WGGITHUB_READGH_ERROR_API.': '.$errMsg.'"');
129 129
                     break;
130 130
             }
131 131
         } else {
Please login to merge, or discard this patch.