Completed
Push — master ( 2ce496...5c1ad5 )
by Sherif
06:14
created
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.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
                 $this->getPostData($route, $reflectionMethod, $validationRules);
60 60
 
61 61
                 preg_match('/api\/v1\/([^#]+)\//iU', $route['uri'], $module);
62
-                preg_match('/api\/v1\/' . $module[1] . '\/([^#]+)\//iU', $route['uri'], $model);
62
+                preg_match('/api\/v1\/'.$module[1].'\/([^#]+)\//iU', $route['uri'], $model);
63 63
                 $docData['modules'][$module[1]][$model[1]][] = $route;
64 64
             }
65 65
         }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      */
75 75
     protected function getRoutes()
76 76
     {
77
-        return collect(\Route::getRoutes())->map(function ($route) {
77
+        return collect(\Route::getRoutes())->map(function($route) {
78 78
             if (strpos($route->uri(), 'api/v') !== false) 
79 79
             {
80 80
                 return [
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         ];
107 107
 
108 108
 
109
-        if (! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) 
109
+        if ( ! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) 
110 110
         {
111 111
             $route['headers']['Authrization'] = 'bearer {token}';
112 112
         }
@@ -159,16 +159,16 @@  discard block
 block discarded – undo
159 159
                 }
160 160
                 else
161 161
                 {
162
-                    $route['body'] = eval('return ' . $match[1] . ';');
162
+                    $route['body'] = eval('return '.$match[1].';');
163 163
                 }
164 164
 
165 165
                 foreach ($route['body'] as &$rule) 
166 166
                 {
167
-                    if(strpos($rule, 'unique'))
167
+                    if (strpos($rule, 'unique'))
168 168
                     {
169 169
                         $rule = substr($rule, 0, strpos($rule, 'unique') + 6);
170 170
                     }
171
-                    elseif(strpos($rule, 'exists'))
171
+                    elseif (strpos($rule, 'exists'))
172 172
                     {
173 173
                         $rule = substr($rule, 0, strpos($rule, 'exists') - 1);
174 174
                     }
Please login to merge, or discard this patch.
src/Modules/V1/Core/Http/Controllers/BaseApiController.php 1 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/Acl/Repositories/UserRepository.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         $user        = \Core::users()->find(\JWTAuth::parseToken()->authenticate()->id, $relations);
27 27
         foreach ($user->groups()->get() as $group)
28 28
         {
29
-            $group->permissions->each(function ($permission) use (&$permissions){
29
+            $group->permissions->each(function($permission) use (&$permissions){
30 30
                 $permissions[$permission->model][$permission->id] = $permission->name;
31 31
             });
32 32
         }
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      * @param  boolean $user
45 45
      * @return boolean
46 46
      */
47
-    public function can($nameOfPermission, $model, $user = false )
47
+    public function can($nameOfPermission, $model, $user = false)
48 48
     {      
49 49
         $user        = $user ?: \JWTAuth::parseToken()->authenticate();
50 50
         $permissions = [];
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
             \ErrorHandler::tokenExpired();
55 55
         }
56 56
 
57
-        $user->groups->pluck('permissions')->each(function ($permission) use (&$permissions, $model){
57
+        $user->groups->pluck('permissions')->each(function($permission) use (&$permissions, $model){
58 58
             $permissions = array_merge($permissions, $permission->where('model', $model)->pluck('name')->toArray()); 
59 59
         });
60 60
         
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function assignGroups($user_id, $group_ids)
84 84
     {
85
-        \DB::transaction(function () use ($user_id, $group_ids) {
85
+        \DB::transaction(function() use ($user_id, $group_ids) {
86 86
             $user = $this->find($user_id);
87 87
             $user->groups()->detach();
88 88
             $user->groups()->attach($group_ids);
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
         $url   = $this->config['resetLink'];
246 246
         $token = \Password::getRepository()->create($user);
247 247
         
248
-        \Mail::send('Acl:resetpassword', ['user' => $user, 'url' => $url, 'token' => $token], function ($m) use ($user) {
248
+        \Mail::send('Acl:resetpassword', ['user' => $user, 'url' => $url, 'token' => $token], function($m) use ($user) {
249 249
             $m->to($user->email, $user->name)->subject('Your Password Reset Link');
250 250
         });
251 251
     }
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
     public function resetPassword($credentials)
260 260
     {
261 261
         $token    = false;
262
-        $response = \Password::reset($credentials, function ($user, $password) use (&$token) {
262
+        $response = \Password::reset($credentials, function($user, $password) use (&$token) {
263 263
             $user->password = bcrypt($password);
264 264
             $user->save();
265 265
 
Please login to merge, or discard this patch.
src/Modules/V1/Core/Http/Controllers/ApiDocumentController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 {
9 9
 	public function index() 
10 10
 	{
11
-		$path       = str_replace($_SERVER['DOCUMENT_ROOT'], '',str_replace('\\', '/', __FILE__));
11
+		$path       = str_replace($_SERVER['DOCUMENT_ROOT'], '', str_replace('\\', '/', __FILE__));
12 12
 		$baseUrl    = str_replace('Http/Controllers/ApiDocumentController.php', '', $path);
13 13
 		$jsonDoc    = json_decode(file_get_contents(app_path('Modules/V1/Core/Resources/api.json')), true);
14 14
 		$modules    = $jsonDoc['modules'];
@@ -68,6 +68,6 @@  discard block
 block discarded – undo
68 68
 		$reflectionClass = new \ReflectionClass($controller);
69 69
 		$classProperties = $reflectionClass->getDefaultProperties();
70 70
 		
71
-		return \Response::json(call_user_func_array("\Core::{$classProperties['model']}", [])->$method(), 200);;
71
+		return \Response::json(call_user_func_array("\Core::{$classProperties['model']}", [])->$method(), 200); ;
72 72
 	}
73 73
 }
Please login to merge, or discard this patch.