Completed
Push — master ( b23027...5a2f77 )
by Sherif
07:56
created
src/Modules/V1/Core/Http/Controllers/BaseApiController.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -170,8 +170,7 @@
 block discarded – undo
170 170
             if ($request->has('id')) 
171 171
             {
172 172
                 $rule = str_replace('{id}', $request->get('id'), $rule);
173
-            }
174
-            else
173
+            } else
175 174
             {
176 175
                 $rule = str_replace(',{id}', '', $rule);
177 176
             }
Please login to merge, or discard this patch.
Doc Comments   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
      * Fetch all records with relations from storage.
46 46
      * 
47 47
      * @param  string  $sortBy The name of the column to sort by.
48
-     * @param  boolean $desc   Sort ascending or descinding (1: desc, 0: asc).
49
-     * @return \Illuminate\Http\Response
48
+     * @param  integer $desc   Sort ascending or descinding (1: desc, 0: asc).
49
+     * @return \Illuminate\Http\JsonResponse|null
50 50
      */
51 51
     public function index($sortBy = 'created_at', $desc = 1) 
52 52
     {
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      * Fetch the single object with relations from storage.
61 61
      * 
62 62
      * @param  integer $id Id of the requested model.
63
-     * @return \Illuminate\Http\Response
63
+     * @return \Illuminate\Http\JsonResponse|null
64 64
      */
65 65
     public function find($id) 
66 66
     {
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
      * @param  string  $query   The search text.
78 78
      * @param  integer $perPage Number of rows per page default 15.
79 79
      * @param  string  $sortBy  The name of the column to sort by.
80
-     * @param  boolean $desc    Sort ascending or descinding (1: desc, 0: asc).
81
-     * @return \Illuminate\Http\Response
80
+     * @param  integer $desc    Sort ascending or descinding (1: desc, 0: asc).
81
+     * @return \Illuminate\Http\JsonResponse|null
82 82
      */
83 83
     public function search($query = '', $perPage = 15, $sortBy = 'created_at', $desc = 1) 
84 84
     {
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
      * 
95 95
      * @param  \Illuminate\Http\Request  $request
96 96
      * @param  string  $sortBy The name of the column to sort by.
97
-     * @param  boolean $desc   Sort ascending or descinding (1: desc, 0: asc).
98
-     * @return \Illuminate\Http\Response
97
+     * @param  integer $desc   Sort ascending or descinding (1: desc, 0: asc).
98
+     * @return \Illuminate\Http\JsonResponse|null
99 99
      */
100 100
     public function findby(Request $request, $sortBy = 'created_at', $desc = 1) 
101 101
     {
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
      * condition.
111 111
      * 
112 112
      * @param  \Illuminate\Http\Request  $request
113
-     * @return \Illuminate\Http\Response
113
+     * @return \Illuminate\Http\JsonResponse|null
114 114
      */
115 115
     public function first(Request $request) 
116 116
     {
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
      * 
126 126
      * @param  integer $perPage Number of rows per page default 15.
127 127
      * @param  string  $sortBy  The name of the column to sort by.
128
-     * @param  boolean $desc    Sort ascending or descinding (1: desc, 0: asc).
129
-     * @return \Illuminate\Http\Response
128
+     * @param  integer $desc    Sort ascending or descinding (1: desc, 0: asc).
129
+     * @return \Illuminate\Http\JsonResponse|null
130 130
      */
131 131
     public function paginate($perPage = 15, $sortBy = 'created_at', $desc = 1) 
132 132
     {
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
      * @param  \Illuminate\Http\Request  $request
144 144
      * @param  integer $perPage Number of rows per page default 15.
145 145
      * @param  string  $sortBy  The name of the column to sort by.
146
-     * @param  boolean $desc    Sort ascending or descinding (1: desc, 0: asc).
147
-     * @return \Illuminate\Http\Response
146
+     * @param  integer $desc    Sort ascending or descinding (1: desc, 0: asc).
147
+     * @return \Illuminate\Http\JsonResponse|null
148 148
      */
149 149
     public function paginateby(Request $request, $perPage = 15, $sortBy = 'created_at', $desc = 1) 
150 150
     {
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      * Save the given model to storage.
159 159
      * 
160 160
      * @param  \Illuminate\Http\Request  $request
161
-     * @return \Illuminate\Http\Response
161
+     * @return \Illuminate\Http\JsonResponse|null
162 162
      */
163 163
     public function save(Request $request) 
164 164
     {
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      * Delete by the given id from storage.
192 192
      * 
193 193
      * @param  integer $id Id of the deleted model.
194
-     * @return \Illuminate\Http\Response
194
+     * @return \Illuminate\Http\JsonResponse|null
195 195
      */
196 196
     public function delete($id) 
197 197
     {
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
      * @param  \Illuminate\Http\Request  $request
208 208
      * @param  integer $perPage Number of rows per page default 15.
209 209
      * @param  string  $sortBy  The name of the column to sort by.
210
-     * @param  boolean $desc    Sort ascending or descinding (1: desc, 0: asc).
211
-     * @return \Illuminate\Http\Response
210
+     * @param  integer $desc    Sort ascending or descinding (1: desc, 0: asc).
211
+     * @return \Illuminate\Http\JsonResponse
212 212
      */
213 213
     public function deleted(Request $request, $perPage = 15, $sortBy = 'created_at', $desc = 1) 
214 214
     {
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
      * Restore the deleted model.
220 220
      * 
221 221
      * @param  integer $id Id of the restored model.
222
-     * @return \Illuminate\Http\Response
222
+     * @return \Illuminate\Http\JsonResponse|null
223 223
      */
224 224
     public function restore($id) 
225 225
     {
Please login to merge, or discard this patch.
src/Modules/V1/Reporting/Repositories/ReportRepository.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,8 +38,7 @@  discard block
 block discarded – undo
38 38
         if ( ! $report) 
39 39
         {
40 40
             \ErrorHandler::notFound('report');
41
-        }
42
-        else if ( ! \Core::users()->can($report->view_name, 'reports'))
41
+        } else if ( ! \Core::users()->can($report->view_name, 'reports'))
43 42
         {
44 43
             \ErrorHandler::noPermissions();
45 44
         }
@@ -60,8 +59,7 @@  discard block
 block discarded – undo
60 59
         if ($perPage) 
61 60
         {
62 61
             return $report->paginate($perPage);
63
-        }
64
-        else
62
+        } else
65 63
         {
66 64
             return $report->get();  
67 65
         }
Please login to merge, or discard this patch.
src/Modules/V1/Acl/Repositories/UserRepository.php 1 patch
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -103,24 +103,19 @@  discard block
 block discarded – undo
103 103
         if ( ! $user = $this->first(['email' => $credentials['email']])) 
104 104
         {
105 105
             \ErrorHandler::loginFailed();
106
-        }
107
-        else if ($adminLogin && $user->groups->pluck('name')->search('Admin', true) === false) 
106
+        } else if ($adminLogin && $user->groups->pluck('name')->search('Admin', true) === false) 
108 107
         {
109 108
             \ErrorHandler::loginFailed();
110
-        }
111
-        else if ( ! $adminLogin && $user->groups->pluck('name')->search('Admin', true) !== false) 
109
+        } else if ( ! $adminLogin && $user->groups->pluck('name')->search('Admin', true) !== false) 
112 110
         {
113 111
             \ErrorHandler::loginFailed();
114
-        }
115
-        else if ($user->blocked)
112
+        } else if ($user->blocked)
116 113
         {
117 114
             \ErrorHandler::userIsBlocked();
118
-        }
119
-        else if ($token = \JWTAuth::attempt($credentials))
115
+        } else if ($token = \JWTAuth::attempt($credentials))
120 116
         {
121 117
             return ['token' => $token];
122
-        }
123
-        else
118
+        } else
124 119
         {
125 120
             \ErrorHandler::loginFailed();
126 121
         }
@@ -146,8 +141,7 @@  discard block
 block discarded – undo
146 141
         {
147 142
             $data = ['email' => $user->email, 'password' => ''];
148 143
             return $this->register($data);
149
-        }
150
-        else
144
+        } else
151 145
         {
152 146
             if ( ! \Auth::attempt(['email' => $registeredUser->email, 'password' => '']))
153 147
             {
@@ -193,12 +187,10 @@  discard block
 block discarded – undo
193 187
         if ( ! $this->hasGroup('Admin'))
194 188
         {
195 189
             \ErrorHandler::noPermissions();
196
-        }
197
-        else if (\JWTAuth::parseToken()->authenticate()->id == $user_id)
190
+        } else if (\JWTAuth::parseToken()->authenticate()->id == $user_id)
198 191
         {
199 192
             \ErrorHandler::noPermissions();
200
-        }
201
-        else if ($user->groups->pluck('name')->search('Admin', true) !== false) 
193
+        } else if ($user->groups->pluck('name')->search('Admin', true) !== false) 
202 194
         {
203 195
             \ErrorHandler::noPermissions();
204 196
         }
Please login to merge, or discard this patch.
src/Modules/V1/Acl/Http/Controllers/UsersController.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -170,8 +170,7 @@
 block discarded – undo
170 170
             if ($request->has('id')) 
171 171
             {
172 172
                 $rule = str_replace('{id}', $request->get('id'), $rule);
173
-            }
174
-            else
173
+            } else
175 174
             {
176 175
                 $rule = str_replace(',{id}', '', $rule);
177 176
             }
Please login to merge, or discard this patch.
src/Modules/V1/Core/AbstractRepositories/AbstractRepository.php 2 patches
Doc Comments   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      *
33 33
      * @param  array   $relations
34 34
      * @param  string  $sortBy
35
-     * @param  boolean $desc
35
+     * @param  integer $desc
36 36
      * @param  array   $columns
37 37
      * @return collection
38 38
      */
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      * @param  integer $perPage
51 51
      * @param  array   $relations
52 52
      * @param  string  $sortBy
53
-     * @param  boolean $desc
53
+     * @param  integer $desc
54 54
      * @param  array   $columns
55 55
      * @return collection
56 56
      */
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      * @param  integer $perPage
140 140
      * @param  array   $relations
141 141
      * @param  string  $sortBy
142
-     * @param  boolean $desc
142
+     * @param  integer $desc
143 143
      * @param  array   $columns
144 144
      * @return collection
145 145
      */
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      * @param  integer $perPage
158 158
      * @param  array   $relations
159 159
      * @param  string  $sortBy
160
-     * @param  boolean $desc
160
+     * @param  integer $desc
161 161
      * @param  array   $columns
162 162
      * @return collection
163 163
      */
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
      * Update record in the storage based on the given
419 419
      * condition.
420 420
      * 
421
-     * @param  var $value condition value
421
+     * @param  boolean $value condition value
422 422
      * @param  array $data
423 423
      * @param  string $attribute condition column name
424 424
      * @return void
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
      * id.
480 480
      * 
481 481
      * @param  integer $id
482
-     * @param  array   $relations
482
+     * @param  string[]   $relations
483 483
      * @param  array   $columns
484 484
      * @return object
485 485
      */
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
      * @param  array   $conditions array of conditions
496 496
      * @param  array   $relations
497 497
      * @param  string  $sortBy
498
-     * @param  boolean $desc
498
+     * @param  integer $desc
499 499
      * @param  array   $columns
500 500
      * @return collection
501 501
      */
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
      * @param  array   $conditions array of conditions
528 528
      * @param  integer $perPage
529 529
      * @param  string  $sortBy
530
-     * @param  boolean $desc
530
+     * @param  integer $desc
531 531
      * @param  array   $columns
532 532
      * @return collection
533 533
      */
Please login to merge, or discard this patch.
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -432,8 +432,7 @@  discard block
 block discarded – undo
432 432
             $model = $this->model->lockForUpdate()->find($value);
433 433
             $model ? $model->update($data) : 0;
434 434
             $saveLog ? \Logging::saveLog('update', class_basename($this->model), $this->getModel(), $value, $model) : false;
435
-        }
436
-        else
435
+        } else
437 436
         {
438 437
             call_user_func_array("{$this->getModel()}::where", array($attribute, '=', $value))->lockForUpdate()->get()->each(function ($model) use ($data, $saveLog){
439 438
                 $model->update($data);
@@ -464,8 +463,7 @@  discard block
 block discarded – undo
464 463
                 $model->delete();
465 464
                 $saveLog ? \Logging::saveLog('delete', class_basename($this->model), $this->getModel(), $value, $model) : false;
466 465
             });
467
-        }
468
-        else
466
+        } else
469 467
         {
470 468
             \DB::transaction(function () use ($value, $attribute, &$result, $saveLog) {
471 469
                 call_user_func_array("{$this->getModel()}::where", array($attribute, '=', $value))->lockForUpdate()->get()->each(function ($model) use ($saveLog){
@@ -582,14 +580,12 @@  discard block
 block discarded – undo
582 580
                 $conditions       = $this->constructConditions($value, $model);
583 581
                 $conditionString .= str_replace('{op}', 'and', $conditions['conditionString']) . ' {op} ';
584 582
                 $conditionValues  = array_merge($conditionValues, $conditions['conditionValues']);
585
-            }
586
-            else if ($key == 'or')
583
+            } else if ($key == 'or')
587 584
             {
588 585
                 $conditions       = $this->constructConditions($value, $model);
589 586
                 $conditionString .= str_replace('{op}', 'or', $conditions['conditionString']) . ' {op} ';
590 587
                 $conditionValues  = array_merge($conditionValues, $conditions['conditionValues']);
591
-            }
592
-            else
588
+            } else
593 589
             {
594 590
                 if (is_array($value)) 
595 591
                 {
@@ -598,13 +594,11 @@  discard block
 block discarded – undo
598 594
                     {
599 595
                         $value1 = $value['val1'];
600 596
                         $value2 = $value['val2'];
601
-                    }
602
-                    else
597
+                    } else
603 598
                     {
604 599
                         $value = array_key_exists('val', $value) ? $value['val'] : '';
605 600
                     }
606
-                }
607
-                else
601
+                } else
608 602
                 {
609 603
                     $operator = '=';
610 604
                 }
@@ -616,29 +610,24 @@  discard block
 block discarded – undo
616 610
 
617 611
                     $conditionString  .= $key . ' <= ? {op} ';
618 612
                     $conditionValues[] = $value2;
619
-                }
620
-                elseif (strtolower($operator) == 'in') 
613
+                } elseif (strtolower($operator) == 'in') 
621 614
                 {
622 615
                     $conditionValues  = array_merge($conditionValues, $value);
623 616
                     $inBindingsString = rtrim(str_repeat('?,', count($value)), ',');
624 617
                     $conditionString .= $key . ' in (' . rtrim($inBindingsString, ',') . ') {op} ';
625
-                }
626
-                elseif (strtolower($operator) == 'null') 
618
+                } elseif (strtolower($operator) == 'null') 
627 619
                 {
628 620
                     $conditionString .= $key . ' is null {op} ';
629
-                }
630
-                elseif (strtolower($operator) == 'not null') 
621
+                } elseif (strtolower($operator) == 'not null') 
631 622
                 {
632 623
                     $conditionString .= $key . ' is not null {op} ';
633
-                }
634
-                elseif (strtolower($operator) == 'has') 
624
+                } elseif (strtolower($operator) == 'has') 
635 625
                 {
636 626
                     $sql              = $model->withTrashed()->has($key)->toSql();
637 627
                     $conditions       = $this->constructConditions($value, $model->$key()->getRelated());
638 628
                     $conditionString .= rtrim(substr($sql, strpos($sql, 'exists')), ')') . ' and ' . $conditions['conditionString'] . ') {op} ';
639 629
                     $conditionValues  = array_merge($conditionValues, $conditions['conditionValues']);
640
-                }
641
-                else
630
+                } else
642 631
                 {
643 632
                     $conditionString  .= $key . ' ' . $operator . ' ? {op} ';
644 633
                     $conditionValues[] = $value;
Please login to merge, or discard this patch.
src/Modules/V1/Core/Console/Commands/GenerateDoc.php 2 patches
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      * Generate headers for the given route.
92 92
      * 
93 93
      * @param  array  &$route
94
-     * @param  object $reflectionClass
94
+     * @param  \ReflectionClass $reflectionClass
95 95
      * @param  string $method
96 96
      * @param  array  $skipLoginCheck
97 97
      * @return void
@@ -118,6 +118,7 @@  discard block
 block discarded – undo
118 118
      * 
119 119
      * @param  array  &$route
120 120
      * @param  object $reflectionMethod]
121
+     * @param \ReflectionMethod $reflectionMethod
121 122
      * @return void
122 123
      */
123 124
     protected function processDocBlock(&$route, $reflectionMethod)
@@ -140,7 +141,7 @@  discard block
 block discarded – undo
140 141
      * Generate post body for the given route.
141 142
      * 
142 143
      * @param  array  &$route
143
-     * @param  object $reflectionMethod
144
+     * @param  \ReflectionMethod $reflectionMethod
144 145
      * @param  array  $validationRules
145 146
      * @return void
146 147
      */
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -156,8 +156,7 @@  discard block
 block discarded – undo
156 156
                 if ($match[1] == '$this->validationRules')
157 157
                 {
158 158
                     $route['body'] = $validationRules;
159
-                }
160
-                else
159
+                } else
161 160
                 {
162 161
                     $route['body'] = eval('return ' . $match[1] . ';');
163 162
                 }
@@ -167,14 +166,12 @@  discard block
 block discarded – undo
167 166
                     if(strpos($rule, 'unique'))
168 167
                     {
169 168
                         $rule = substr($rule, 0, strpos($rule, 'unique') + 6);
170
-                    }
171
-                    elseif(strpos($rule, 'exists'))
169
+                    } elseif(strpos($rule, 'exists'))
172 170
                     {
173 171
                         $rule = substr($rule, 0, strpos($rule, 'exists') - 1);
174 172
                     }
175 173
                 }
176
-            }
177
-            else
174
+            } else
178 175
             {
179 176
                 $route['body'] = 'conditions';
180 177
             }
Please login to merge, or discard this patch.
src/Modules/V1/Core/Decorators/CachingDecorator.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -68,8 +68,7 @@  discard block
 block discarded – undo
68 68
             return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function() use ($arguments, $name) {
69 69
                 return call_user_func_array([$this->repo, $name], $arguments);
70 70
             });
71
-        }
72
-        else if ($this->cacheConfig)
71
+        } else if ($this->cacheConfig)
73 72
         {
74 73
             $this->cache->tags($this->cacheConfig)->flush();
75 74
             return call_user_func_array([$this->repo, $name], $arguments);
@@ -93,8 +92,7 @@  discard block
 block discarded – undo
93 92
         if ($cacheConfig && in_array($name, $cacheConfig['cache']))
94 93
         {
95 94
             $this->cacheConfig = 'cache';
96
-        }
97
-        else if ($cacheConfig && isset($cacheConfig['clear'][$name]))
95
+        } else if ($cacheConfig && isset($cacheConfig['clear'][$name]))
98 96
         {
99 97
             $this->cacheConfig = $cacheConfig['clear'][$name];
100 98
         }
Please login to merge, or discard this patch.
src/Modules/V1/Notifications/Jobs/PushNotifications.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -20,6 +20,9 @@
 block discarded – undo
20 20
     /**
21 21
      * Create a new job instance.
22 22
      *
23
+     * @param \LaravelFCM\Message\Options $option
24
+     * @param \LaravelFCM\Message\PayloadNotification $notification
25
+     * @param \LaravelFCM\Message\PayloadData $data
23 26
      * @return void
24 27
      */
25 28
     public function __construct($option, $notification, $data, $tokens)
Please login to merge, or discard this patch.
Modules/V1/Notifications/Repositories/PushNotificationDeviceRepository.php 1 patch
Doc Comments   -3 removed lines patch added patch discarded remove patch
@@ -21,9 +21,6 @@
 block discarded – undo
21 21
     /**
22 22
      * Set the notification notified to all.
23 23
      *
24
-     * @param  array  $users_ids
25
-     * @param  string $title
26
-     * @param  string $message
27 24
      * @param  string $data
28 25
      * @return void
29 26
      */
Please login to merge, or discard this patch.