Completed
Push — master ( b79faa...aa40d3 )
by Sherif
14:14
created
src/Modules/V1/Reporting/Repositories/ReportRepository.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
      *
47 47
      * @param  array   $conditions array of conditions
48 48
      * @param  array   $relations
49
-     * @param  array   $colunmns
49
+     * @param  array   $columns
50 50
      * @return object
51 51
      */
52 52
     public function first($conditions, $relations = [], $columns = array('*'))
Please login to merge, or discard this patch.
src/Modules/V1/Acl/Repositories/UserRepository.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -202,7 +202,7 @@
 block discarded – undo
202 202
      * Reset the given user's password.
203 203
      *
204 204
      * @param  array  $credentials
205
-     * @return integer
205
+     * @return false|null
206 206
      */
207 207
     public function resetPassword($credentials)
208 208
     {
Please login to merge, or discard this patch.
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -76,24 +76,19 @@  discard block
 block discarded – undo
76 76
         if ( ! $user = $this->first(['email' => $credentials['email']])) 
77 77
         {
78 78
             \ErrorHandler::loginFailed();
79
-        }
80
-        else if ($adminLogin && $user->groups->lists('name')->search('Admin', true) === false) 
79
+        } else if ($adminLogin && $user->groups->lists('name')->search('Admin', true) === false) 
81 80
         {
82 81
             \ErrorHandler::loginFailed();
83
-        }
84
-        else if ( ! $adminLogin && $user->groups->lists('name')->search('Admin', true) !== false) 
82
+        } else if ( ! $adminLogin && $user->groups->lists('name')->search('Admin', true) !== false) 
85 83
         {
86 84
             \ErrorHandler::loginFailed();
87
-        }
88
-        else if ($user->blocked)
85
+        } else if ($user->blocked)
89 86
         {
90 87
             \ErrorHandler::userIsBlocked();
91
-        }
92
-        else if ($token = \JWTAuth::attempt($credentials))
88
+        } else if ($token = \JWTAuth::attempt($credentials))
93 89
         {
94 90
             return ['token' => $token];
95
-        }
96
-        else
91
+        } else
97 92
         {
98 93
             \ErrorHandler::loginFailed();
99 94
         }
@@ -118,8 +113,7 @@  discard block
 block discarded – undo
118 113
         {
119 114
             $data = ['email' => $user->email, 'password' => ''];
120 115
             return $this->register($data);
121
-        }
122
-        else
116
+        } else
123 117
         {
124 118
             return $this->login(['email' => $registeredUser->email, 'password' => ''], false);
125 119
         }
@@ -161,12 +155,10 @@  discard block
 block discarded – undo
161 155
         if ( ! $this->hasGroup('Admin'))
162 156
         {
163 157
             \ErrorHandler::noPermissions();
164
-        }
165
-        else if (\JWTAuth::parseToken()->authenticate()->id == $user_id)
158
+        } else if (\JWTAuth::parseToken()->authenticate()->id == $user_id)
166 159
         {
167 160
             \ErrorHandler::noPermissions();
168
-        }
169
-        else if ($user->groups->lists('name')->search('Admin', true) !== false) 
161
+        } else if ($user->groups->lists('name')->search('Admin', true) !== false) 
170 162
         {
171 163
             \ErrorHandler::noPermissions();
172 164
         }
Please login to merge, or discard this patch.
src/Modules/V1/Core/Http/Controllers/BaseApiController.php 2 patches
Doc Comments   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     /**
38 38
      * Fetch all records with relations from model repository.
39 39
      * 
40
-     * @return \Illuminate\Http\Response
40
+     * @return \Illuminate\Http\JsonResponse|null
41 41
      */
42 42
     public function getIndex() 
43 43
     {
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      * Fetch the single object with relations from model repository.
53 53
      * 
54 54
      * @param  integer $id
55
-     * @return \Illuminate\Http\Response
55
+     * @return \Illuminate\Http\JsonResponse|null
56 56
      */
57 57
     public function getFind($id) 
58 58
     {
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
      * @param  string  $query
71 71
      * @param  integer $perPage
72 72
      * @param  string  $sortBy
73
-     * @param  boolean $desc
74
-     * @return \Illuminate\Http\Response
73
+     * @param  integer $desc
74
+     * @return \Illuminate\Http\JsonResponse|null
75 75
      */
76 76
     public function getSearch($query = '', $perPage = 15, $sortBy = 'created_at', $desc = 1) 
77 77
     {
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
      * 
89 89
      * @param  \Illuminate\Http\Request  $request
90 90
      * @param  string  $sortBy
91
-     * @param  boolean $desc
92
-     * @return \Illuminate\Http\Response
91
+     * @param  integer $desc
92
+     * @return \Illuminate\Http\JsonResponse|null
93 93
      */
94 94
     public function postFindby(Request $request, $sortBy = 'created_at', $desc = 1) 
95 95
     {
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
      * condition.
106 106
      * 
107 107
      * @param  \Illuminate\Http\Request  $request
108
-     * @return \Illuminate\Http\Response
108
+     * @return \Illuminate\Http\JsonResponse|null
109 109
      */
110 110
     public function postFirst(Request $request) 
111 111
     {
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
      * 
122 122
      * @param  integer $perPage
123 123
      * @param  string  $sortBy
124
-     * @param  boolean $desc
125
-     * @return \Illuminate\Http\Response
124
+     * @param  integer $desc
125
+     * @return \Illuminate\Http\JsonResponse|null
126 126
      */
127 127
     public function getPaginate($perPage = 15, $sortBy = 'created_at', $desc = 1) 
128 128
     {
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
      * @param  \Illuminate\Http\Request  $request
141 141
      * @param  integer $perPage
142 142
      * @param  string  $sortBy
143
-     * @param  boolean $desc
144
-     * @return \Illuminate\Http\Response
143
+     * @param  integer $desc
144
+     * @return \Illuminate\Http\JsonResponse|null
145 145
      */
146 146
     public function postPaginateby(Request $request, $perPage = 15, $sortBy = 'created_at', $desc = 1) 
147 147
     {
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      * Save the given model to repository.
157 157
      * 
158 158
      * @param  \Illuminate\Http\Request  $request
159
-     * @return \Illuminate\Http\Response
159
+     * @return \Illuminate\Http\JsonResponse|null
160 160
      */
161 161
     public function postSave(Request $request) 
162 162
     {
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
      * Delete by the given id from model repository.
190 190
      * 
191 191
      * @param  integer  $id
192
-     * @return \Illuminate\Http\Response
192
+     * @return \Illuminate\Http\JsonResponse|null
193 193
      */
194 194
     public function getDelete($id) 
195 195
     {
Please login to merge, or discard this 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   +7 added lines, -7 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
      */
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
      * 
175 175
      * @param  array   $data
176 176
      * @param  boolean $saveLog
177
-     * @return object
177
+     * @return boolean
178 178
      */
179 179
     public function save(array $data, $saveLog = true)
180 180
     {
@@ -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
      */
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -430,8 +430,7 @@  discard block
 block discarded – undo
430 430
             $model = $this->model->lockForUpdate()->find($value);
431 431
             $model ? $model->update($data) : 0;
432 432
             $saveLog ? $this->logs->saveLog('update', class_basename($this->model), $this->getModel(), $value, $model) : false;
433
-        }
434
-        else
433
+        } else
435 434
         {
436 435
             call_user_func_array("{$this->getModel()}::where", array($attribute, '=', $value))->lockForUpdate()->get()->each(function ($model) use ($data, $saveLog){
437 436
                 $model->update($data);
@@ -462,8 +461,7 @@  discard block
 block discarded – undo
462 461
                 $model->delete();
463 462
                 $saveLog ? \Logging::saveLog('delete', class_basename($this->model), $this->getModel(), $value, $model) : false;
464 463
             });
465
-        }
466
-        else
464
+        } else
467 465
         {
468 466
             \DB::transaction(function () use ($value, $attribute, &$result, $saveLog) {
469 467
                 call_user_func_array("{$this->getModel()}::where", array($attribute, '=', $value))->lockForUpdate()->get()->each(function ($model){
@@ -536,13 +534,11 @@  discard block
 block discarded – undo
536 534
             {
537 535
                 $conditionString  .= str_replace('{op}', 'and', $this->constructConditions($value)['conditionString']) . ' {op} ';
538 536
                 $conditionValues   = array_merge($conditionValues, $this->constructConditions($value)['conditionValues']);
539
-            }
540
-            else if ($key == 'or')
537
+            } else if ($key == 'or')
541 538
             {
542 539
                 $conditionString  .= str_replace('{op}', 'or', $this->constructConditions($value)['conditionString']) . ' {op} ';
543 540
                 $conditionValues   = array_merge($conditionValues, $this->constructConditions($value)['conditionValues']);
544
-            }
545
-            else
541
+            } else
546 542
             {
547 543
                 $conditionString  .= $key . '=? {op} ';
548 544
                 $conditionValues[] = $value;
Please login to merge, or discard this patch.
src/Modules/V1/Notifications/Repositories/NotificationRepository.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
      * Set the notification notified to true.
19 19
      * 
20 20
      * @param  integer  $id
21
-     * @return object
21
+     * @return boolean
22 22
      */
23 23
     public function notified($id)
24 24
     {
Please login to merge, or discard this patch.