Completed
Push — master ( 8a761d...35b920 )
by Sherif
02:19
created
src/Modules/Core/Http/Requests/StoreSetting.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -6,25 +6,25 @@
 block discarded – undo
6 6
 
7 7
 class StoreSetting extends FormRequest
8 8
 {
9
-    /**
10
-     * Determine if the user is authorized to make this request.
11
-     *
12
-     * @return bool
13
-     */
14
-    public function authorize()
15
-    {
16
-        return true;
17
-    }
9
+	/**
10
+	 * Determine if the user is authorized to make this request.
11
+	 *
12
+	 * @return bool
13
+	 */
14
+	public function authorize()
15
+	{
16
+		return true;
17
+	}
18 18
 
19
-    /**
20
-     * Get the validation rules that apply to the request.
21
-     *
22
-     * @return array
23
-     */
24
-    public function rules()
25
-    {
26
-        return [
27
-            'value' => 'required|string'
28
-        ];
29
-    }
19
+	/**
20
+	 * Get the validation rules that apply to the request.
21
+	 *
22
+	 * @return array
23
+	 */
24
+	public function rules()
25
+	{
26
+		return [
27
+			'value' => 'required|string'
28
+		];
29
+	}
30 30
 }
Please login to merge, or discard this patch.
src/Modules/Core/Routes/api.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 |
12 12
 */
13 13
 
14
-Route::group(['prefix' => 'settings'], function () {
14
+Route::group(['prefix' => 'settings'], function() {
15 15
 
16 16
     Route::get('/', 'SettingController@index');
17 17
     Route::get('{id}', 'SettingController@show');
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@
 block discarded – undo
13 13
 
14 14
 Route::group(['prefix' => 'settings'], function () {
15 15
 
16
-    Route::get('/', 'SettingController@index');
17
-    Route::get('{id}', 'SettingController@show');
18
-    Route::patch('{id}', 'SettingController@update');
19
-    Route::post('save/many', 'SettingController@saveMany');
16
+	Route::get('/', 'SettingController@index');
17
+	Route::get('{id}', 'SettingController@show');
18
+	Route::patch('{id}', 'SettingController@update');
19
+	Route::post('save/many', 'SettingController@saveMany');
20 20
 });
Please login to merge, or discard this patch.
src/Modules/Users/Http/Controllers/UserController.php 1 patch
Indentation   +207 added lines, -207 removed lines patch added patch discarded remove patch
@@ -20,211 +20,211 @@
 block discarded – undo
20 20
 
21 21
 class UserController extends BaseApiController
22 22
 {
23
-    /**
24
-     * Path of the sotre form request.
25
-     *
26
-     * @var string
27
-     */
28
-    protected $storeFormRequest = 'App\Modules\Users\Http\Requests\StoreUser';
29
-
30
-    /**
31
-     * Path of the model resource.
32
-     *
33
-     * @var string
34
-     */
35
-    protected $modelResource = 'App\Modules\Users\Http\Resources\AclUser';
36
-
37
-    /**
38
-     * List of all route actions that the base api controller
39
-     * will skip permissions check for them.
40
-     * @var array
41
-     */
42
-    protected $skipPermissionCheck = ['account', 'logout', 'changePassword', 'saveProfile'];
43
-
44
-    /**
45
-     * List of all route actions that the base api controller
46
-     * will skip login check for them.
47
-     * @var array
48
-     */
49
-    protected $skipLoginCheck = ['login', 'loginSocial', 'register', 'sendReset', 'resetPassword', 'refreshToken', 'confirmEmail', 'resendEmailConfirmation'];
50
-
51
-    /**
52
-     * Init new object.
53
-     *
54
-     * @param   UserService $service
55
-     * @return  void
56
-     */
57
-    public function __construct(UserService $service)
58
-    {
59
-        parent::__construct($service);
60
-    }
61
-
62
-    /**
63
-     * Return the logged in user account.
64
-     *
65
-     * @param Request $request
66
-     * @return \Illuminate\Http\Response
67
-     */
68
-    public function account(Request $request)
69
-    {
70
-        return new $this->modelResource($this->service->account($request->relations));
71
-    }
72
-
73
-    /**
74
-     * Block the user.
75
-     *
76
-     * @param  integer  $id Id of the user.
77
-     * @return \Illuminate\Http\Response
78
-     */
79
-    public function block($id)
80
-    {
81
-        return new $this->modelResource($this->service->block($id));
82
-    }
83
-
84
-    /**
85
-     * Unblock the user.
86
-     *
87
-     * @param  integer  $id Id of the user.
88
-     * @return \Illuminate\Http\Response
89
-     */
90
-    public function unblock($id)
91
-    {
92
-        return new $this->modelResource($this->service->unblock($id));
93
-    }
94
-
95
-    /**
96
-     * Logout the user.
97
-     *
98
-     * @return \Illuminate\Http\Response
99
-     */
100
-    public function logout()
101
-    {
102
-        return new GeneralResource($this->service->logout());
103
-    }
104
-
105
-    /**
106
-     * Handle the registration request.
107
-     *
108
-     * @param Register $request
109
-     * @return \Illuminate\Http\Response
110
-     */
111
-    public function register(Register $request)
112
-    {
113
-        return new $this->modelResource($this->service->register($request->get('name'), $request->get('email'), $request->get('password')));
114
-    }
115
-
116
-    /**
117
-     * Handle the login request to the application.
118
-     *
119
-     * @param Login $request
120
-     * @return \Illuminate\Http\Response
121
-     */
122
-    public function login(Login $request)
123
-    {
124
-        $result = $this->service->login($request->get('email'), $request->get('password'));
125
-
126
-        return (new $this->modelResource($result['user']))->additional(['meta' => $result['tokens']]);
127
-    }
128
-
129
-    /**
130
-     * Handle the social login request the application.
131
-     *
132
-     * @param LoginSocial $request
133
-     * @return \Illuminate\Http\Response
134
-     */
135
-    public function loginSocial(LoginSocial $request)
136
-    {
137
-        $result = $this->service->loginSocial($request->get('auth_code'), $request->get('access_token'), $request->get('type'));
138
-
139
-        return (new $this->modelResource($result['user']))->additional(['meta' => $result['tokens']]);
140
-    }
141
-
142
-    /**
143
-     * Assign the given roles to the given user.
144
-     *
145
-     * @param AssignRoles $request
146
-     * @param integer     $id
147
-     * @return \Illuminate\Http\Response
148
-     */
149
-    public function assignRoles(AssignRoles $request, $id)
150
-    {
151
-        return new $this->modelResource($this->service->assignRoles($id, $request->get('role_ids')));
152
-    }
153
-
154
-    /**
155
-     * Send a reset link to the given user.
156
-     *
157
-     * @param SendReset $request
158
-     * @return \Illuminate\Http\Response
159
-     */
160
-    public function sendReset(SendReset $request)
161
-    {
162
-        return new GeneralResource($this->service->sendReset($request->get('email')));
163
-    }
164
-
165
-    /**
166
-     * Reset the given user's password.
167
-     *
168
-     * @param ResetPassword $request
169
-     * @return \Illuminate\Http\Response
170
-     */
171
-    public function resetPassword(ResetPassword $request)
172
-    {
173
-        return new GeneralResource($this->service->resetPassword($request->get('email'), $request->get('password'), $request->get('password_confirmation'), $request->get('token')));
174
-    }
175
-
176
-    /**
177
-     * Change the logged in user password.
178
-     *
179
-     * @param ChangePassword $request
180
-     * @return \Illuminate\Http\Response
181
-     */
182
-    public function changePassword(ChangePassword $request)
183
-    {
184
-        return new GeneralResource($this->service->changePassword($request->get('password'), $request->get('old_password')));
185
-    }
186
-
187
-    /**
188
-     * Confirm email using the confirmation code.
189
-     *
190
-     * @param ConfirmEmail $request
191
-     * @return \Illuminate\Http\Response
192
-     */
193
-    public function confirmEmail(ConfirmEmail $request)
194
-    {
195
-        return new GeneralResource($this->service->confirmEmail($request->only('confirmation_code')));
196
-    }
197
-
198
-    /**
199
-     * Resend the email confirmation mail.
200
-     *
201
-     * @param ResendEmailConfirmation $request
202
-     * @return \Illuminate\Http\Response
203
-     */
204
-    public function resendEmailConfirmation(ResendEmailConfirmation $request)
205
-    {
206
-        return new GeneralResource($this->service->sendConfirmationEmail($request->get('email')));
207
-    }
208
-
209
-    /**
210
-     * Refresh the expired login token.
211
-     *
212
-     * @param RefreshToken $request
213
-     * @return \Illuminate\Http\Response
214
-     */
215
-    public function refreshToken(RefreshToken $request)
216
-    {
217
-        return new GeneralResource($this->service->refreshToken($request->get('refresh_token')));
218
-    }
219
-
220
-    /**
221
-     * Save the given data to the logged in user.
222
-     *
223
-     * @param SaveProfile $request
224
-     * @return \Illuminate\Http\Response
225
-     */
226
-    public function saveProfile(SaveProfile $request)
227
-    {
228
-        return new $this->modelResource($this->service->saveProfile($request->get('name'), $request->get('email'), $request->get('profile_picture')));
229
-    }
23
+	/**
24
+	 * Path of the sotre form request.
25
+	 *
26
+	 * @var string
27
+	 */
28
+	protected $storeFormRequest = 'App\Modules\Users\Http\Requests\StoreUser';
29
+
30
+	/**
31
+	 * Path of the model resource.
32
+	 *
33
+	 * @var string
34
+	 */
35
+	protected $modelResource = 'App\Modules\Users\Http\Resources\AclUser';
36
+
37
+	/**
38
+	 * List of all route actions that the base api controller
39
+	 * will skip permissions check for them.
40
+	 * @var array
41
+	 */
42
+	protected $skipPermissionCheck = ['account', 'logout', 'changePassword', 'saveProfile'];
43
+
44
+	/**
45
+	 * List of all route actions that the base api controller
46
+	 * will skip login check for them.
47
+	 * @var array
48
+	 */
49
+	protected $skipLoginCheck = ['login', 'loginSocial', 'register', 'sendReset', 'resetPassword', 'refreshToken', 'confirmEmail', 'resendEmailConfirmation'];
50
+
51
+	/**
52
+	 * Init new object.
53
+	 *
54
+	 * @param   UserService $service
55
+	 * @return  void
56
+	 */
57
+	public function __construct(UserService $service)
58
+	{
59
+		parent::__construct($service);
60
+	}
61
+
62
+	/**
63
+	 * Return the logged in user account.
64
+	 *
65
+	 * @param Request $request
66
+	 * @return \Illuminate\Http\Response
67
+	 */
68
+	public function account(Request $request)
69
+	{
70
+		return new $this->modelResource($this->service->account($request->relations));
71
+	}
72
+
73
+	/**
74
+	 * Block the user.
75
+	 *
76
+	 * @param  integer  $id Id of the user.
77
+	 * @return \Illuminate\Http\Response
78
+	 */
79
+	public function block($id)
80
+	{
81
+		return new $this->modelResource($this->service->block($id));
82
+	}
83
+
84
+	/**
85
+	 * Unblock the user.
86
+	 *
87
+	 * @param  integer  $id Id of the user.
88
+	 * @return \Illuminate\Http\Response
89
+	 */
90
+	public function unblock($id)
91
+	{
92
+		return new $this->modelResource($this->service->unblock($id));
93
+	}
94
+
95
+	/**
96
+	 * Logout the user.
97
+	 *
98
+	 * @return \Illuminate\Http\Response
99
+	 */
100
+	public function logout()
101
+	{
102
+		return new GeneralResource($this->service->logout());
103
+	}
104
+
105
+	/**
106
+	 * Handle the registration request.
107
+	 *
108
+	 * @param Register $request
109
+	 * @return \Illuminate\Http\Response
110
+	 */
111
+	public function register(Register $request)
112
+	{
113
+		return new $this->modelResource($this->service->register($request->get('name'), $request->get('email'), $request->get('password')));
114
+	}
115
+
116
+	/**
117
+	 * Handle the login request to the application.
118
+	 *
119
+	 * @param Login $request
120
+	 * @return \Illuminate\Http\Response
121
+	 */
122
+	public function login(Login $request)
123
+	{
124
+		$result = $this->service->login($request->get('email'), $request->get('password'));
125
+
126
+		return (new $this->modelResource($result['user']))->additional(['meta' => $result['tokens']]);
127
+	}
128
+
129
+	/**
130
+	 * Handle the social login request the application.
131
+	 *
132
+	 * @param LoginSocial $request
133
+	 * @return \Illuminate\Http\Response
134
+	 */
135
+	public function loginSocial(LoginSocial $request)
136
+	{
137
+		$result = $this->service->loginSocial($request->get('auth_code'), $request->get('access_token'), $request->get('type'));
138
+
139
+		return (new $this->modelResource($result['user']))->additional(['meta' => $result['tokens']]);
140
+	}
141
+
142
+	/**
143
+	 * Assign the given roles to the given user.
144
+	 *
145
+	 * @param AssignRoles $request
146
+	 * @param integer     $id
147
+	 * @return \Illuminate\Http\Response
148
+	 */
149
+	public function assignRoles(AssignRoles $request, $id)
150
+	{
151
+		return new $this->modelResource($this->service->assignRoles($id, $request->get('role_ids')));
152
+	}
153
+
154
+	/**
155
+	 * Send a reset link to the given user.
156
+	 *
157
+	 * @param SendReset $request
158
+	 * @return \Illuminate\Http\Response
159
+	 */
160
+	public function sendReset(SendReset $request)
161
+	{
162
+		return new GeneralResource($this->service->sendReset($request->get('email')));
163
+	}
164
+
165
+	/**
166
+	 * Reset the given user's password.
167
+	 *
168
+	 * @param ResetPassword $request
169
+	 * @return \Illuminate\Http\Response
170
+	 */
171
+	public function resetPassword(ResetPassword $request)
172
+	{
173
+		return new GeneralResource($this->service->resetPassword($request->get('email'), $request->get('password'), $request->get('password_confirmation'), $request->get('token')));
174
+	}
175
+
176
+	/**
177
+	 * Change the logged in user password.
178
+	 *
179
+	 * @param ChangePassword $request
180
+	 * @return \Illuminate\Http\Response
181
+	 */
182
+	public function changePassword(ChangePassword $request)
183
+	{
184
+		return new GeneralResource($this->service->changePassword($request->get('password'), $request->get('old_password')));
185
+	}
186
+
187
+	/**
188
+	 * Confirm email using the confirmation code.
189
+	 *
190
+	 * @param ConfirmEmail $request
191
+	 * @return \Illuminate\Http\Response
192
+	 */
193
+	public function confirmEmail(ConfirmEmail $request)
194
+	{
195
+		return new GeneralResource($this->service->confirmEmail($request->only('confirmation_code')));
196
+	}
197
+
198
+	/**
199
+	 * Resend the email confirmation mail.
200
+	 *
201
+	 * @param ResendEmailConfirmation $request
202
+	 * @return \Illuminate\Http\Response
203
+	 */
204
+	public function resendEmailConfirmation(ResendEmailConfirmation $request)
205
+	{
206
+		return new GeneralResource($this->service->sendConfirmationEmail($request->get('email')));
207
+	}
208
+
209
+	/**
210
+	 * Refresh the expired login token.
211
+	 *
212
+	 * @param RefreshToken $request
213
+	 * @return \Illuminate\Http\Response
214
+	 */
215
+	public function refreshToken(RefreshToken $request)
216
+	{
217
+		return new GeneralResource($this->service->refreshToken($request->get('refresh_token')));
218
+	}
219
+
220
+	/**
221
+	 * Save the given data to the logged in user.
222
+	 *
223
+	 * @param SaveProfile $request
224
+	 * @return \Illuminate\Http\Response
225
+	 */
226
+	public function saveProfile(SaveProfile $request)
227
+	{
228
+		return new $this->modelResource($this->service->saveProfile($request->get('name'), $request->get('email'), $request->get('profile_picture')));
229
+	}
230 230
 }
Please login to merge, or discard this patch.
src/Modules/Core/Console/Commands/GenerateDocCommand.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
     /**
208 208
      * Get the given method body code.
209 209
      *
210
-     * @param  object $reflectionMethod
210
+     * @param  \ReflectionMethod $reflectionMethod
211 211
      * @return string
212 212
      */
213 213
     protected function getMethodBody($reflectionMethod)
@@ -228,6 +228,7 @@  discard block
 block discarded – undo
228 228
      *
229 229
      * @param  string $modelName
230 230
      * @param  array  $docData
231
+     * @param \ReflectionClass $reflectionClass
231 232
      * @return string
232 233
      */
233 234
     protected function getModels($modelName, &$docData, $reflectionClass)
Please login to merge, or discard this patch.
Indentation   +301 added lines, -301 removed lines patch added patch discarded remove patch
@@ -8,307 +8,307 @@
 block discarded – undo
8 8
 
9 9
 class GenerateDocCommand extends Command
10 10
 {
11
-    /**
12
-     * The name and signature of the console command.
13
-     *
14
-     * @var string
15
-     */
16
-    protected $signature = 'doc:generate';
17
-
18
-    /**
19
-     * The console command description.
20
-     *
21
-     * @var string
22
-     */
23
-    protected $description = 'Generate api documentation';
24
-
25
-    /**
26
-     * @var ReprotService
27
-     */
28
-    protected $reportService;
29
-
30
-    /**
31
-     * Init new object.
32
-     *
33
-     * @return  void
34
-     */
35
-    public function __construct(ReportService $reportService)
36
-    {
37
-        $this->reportService = $reportService;
38
-        parent::__construct();
39
-    }
40
-
41
-    /**
42
-     * Execute the console command.
43
-     *
44
-     * @return mixed
45
-     */
46
-    public function handle()
47
-    {
48
-        $docData           = [];
49
-        $docData['models'] = [];
50
-        $routes            = $this->getRoutes();
51
-        foreach ($routes as $route) {
52
-            if ($route) {
53
-                $actoinArray = explode('@', $route['action']);
54
-                if (Arr::get($actoinArray, 1, false)) {
55
-                    $prefix = $route['prefix'];
56
-                    $module = \Str::camel(str_replace('/', '_', str_replace('api', '', $prefix)));
57
-                    if ($prefix === 'telescope') {
58
-                        continue;
59
-                    }
60
-
61
-                    $controller       = $actoinArray[0];
62
-                    $method           = $actoinArray[1];
63
-                    $route['name']    = $method;
64
-                    $reflectionClass  = new \ReflectionClass($controller);
65
-                    $reflectionMethod = $reflectionClass->getMethod($method);
66
-                    $classProperties  = $reflectionClass->getDefaultProperties();
67
-                    $skipLoginCheck   = Arr::get($classProperties, 'skipLoginCheck', false);
68
-                    $modelName        = explode('\\', $controller);
69
-                    $modelName        = lcfirst(str_replace('Controller', '', end($modelName)));
70
-
71
-                    $this->processDocBlock($route, $reflectionMethod);
72
-                    $this->getHeaders($route, $method, $skipLoginCheck);
73
-                    $this->getPostData($route, $reflectionMethod, explode('\\', $reflectionClass->getName())[2], $modelName);
74
-
75
-                    $route['response'] = $this->getResponseObject($modelName, $route['name'], $route['returnDocBlock']);
76
-                    $docData['modules'][$module][] = $route;
77
-
78
-                    $this->getModels($modelName, $docData, $reflectionClass);
79
-                }
80
-            }
81
-        }
11
+	/**
12
+	 * The name and signature of the console command.
13
+	 *
14
+	 * @var string
15
+	 */
16
+	protected $signature = 'doc:generate';
17
+
18
+	/**
19
+	 * The console command description.
20
+	 *
21
+	 * @var string
22
+	 */
23
+	protected $description = 'Generate api documentation';
24
+
25
+	/**
26
+	 * @var ReprotService
27
+	 */
28
+	protected $reportService;
29
+
30
+	/**
31
+	 * Init new object.
32
+	 *
33
+	 * @return  void
34
+	 */
35
+	public function __construct(ReportService $reportService)
36
+	{
37
+		$this->reportService = $reportService;
38
+		parent::__construct();
39
+	}
40
+
41
+	/**
42
+	 * Execute the console command.
43
+	 *
44
+	 * @return mixed
45
+	 */
46
+	public function handle()
47
+	{
48
+		$docData           = [];
49
+		$docData['models'] = [];
50
+		$routes            = $this->getRoutes();
51
+		foreach ($routes as $route) {
52
+			if ($route) {
53
+				$actoinArray = explode('@', $route['action']);
54
+				if (Arr::get($actoinArray, 1, false)) {
55
+					$prefix = $route['prefix'];
56
+					$module = \Str::camel(str_replace('/', '_', str_replace('api', '', $prefix)));
57
+					if ($prefix === 'telescope') {
58
+						continue;
59
+					}
60
+
61
+					$controller       = $actoinArray[0];
62
+					$method           = $actoinArray[1];
63
+					$route['name']    = $method;
64
+					$reflectionClass  = new \ReflectionClass($controller);
65
+					$reflectionMethod = $reflectionClass->getMethod($method);
66
+					$classProperties  = $reflectionClass->getDefaultProperties();
67
+					$skipLoginCheck   = Arr::get($classProperties, 'skipLoginCheck', false);
68
+					$modelName        = explode('\\', $controller);
69
+					$modelName        = lcfirst(str_replace('Controller', '', end($modelName)));
70
+
71
+					$this->processDocBlock($route, $reflectionMethod);
72
+					$this->getHeaders($route, $method, $skipLoginCheck);
73
+					$this->getPostData($route, $reflectionMethod, explode('\\', $reflectionClass->getName())[2], $modelName);
74
+
75
+					$route['response'] = $this->getResponseObject($modelName, $route['name'], $route['returnDocBlock']);
76
+					$docData['modules'][$module][] = $route;
77
+
78
+					$this->getModels($modelName, $docData, $reflectionClass);
79
+				}
80
+			}
81
+		}
82 82
         
83
-        $docData['errors']  = $this->getErrors();
84
-        $docData['reports'] = $this->reportService->all();
85
-        \File::put(app_path('Modules/Core/Resources/api.json'), json_encode($docData));
86
-    }
87
-
88
-    /**
89
-     * Get list of all registered routes.
90
-     *
91
-     * @return collection
92
-     */
93
-    protected function getRoutes()
94
-    {
95
-        return collect(\Route::getRoutes())->map(function ($route) {
96
-            if (strpos($route->uri(), 'api/') !== false) {
97
-                return [
98
-                    'method' => $route->methods()[0],
99
-                    'uri'    => $route->uri(),
100
-                    'action' => $route->getActionName(),
101
-                    'prefix' => $route->getPrefix()
102
-                ];
103
-            }
104
-            return false;
105
-        })->all();
106
-    }
107
-
108
-    /**
109
-     * Generate headers for the given route.
110
-     *
111
-     * @param  array  &$route
112
-     * @param  string $method
113
-     * @param  array  $skipLoginCheck
114
-     * @return void
115
-     */
116
-    protected function getHeaders(&$route, $method, $skipLoginCheck)
117
-    {
118
-        $route['headers'] = [
119
-        'Accept'         => 'application/json',
120
-        'Content-Type'   => 'application/json',
121
-        'Accept-Language' => 'The language of the returned data: ar, en or all.',
122
-        'time-zone'       => 'Your locale time zone',
123
-        ];
124
-
125
-
126
-        if (! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) {
127
-            $route['headers']['Authorization'] = 'Bearer {token}';
128
-        }
129
-    }
130
-
131
-    /**
132
-     * Generate description and params for the given route
133
-     * based on the docblock.
134
-     *
135
-     * @param  array  &$route
136
-     * @param  \ReflectionMethod $reflectionMethod
137
-     * @return void
138
-     */
139
-    protected function processDocBlock(&$route, $reflectionMethod)
140
-    {
141
-        $factory                 = \phpDocumentor\Reflection\DocBlockFactory::createInstance();
142
-        $docblock                = $factory->create($reflectionMethod->getDocComment());
143
-        $route['description']    = trim(preg_replace('/\s+/', ' ', $docblock->getSummary()));
144
-        $params                  = $docblock->getTagsByName('param');
145
-        $route['returnDocBlock'] = $docblock->getTagsByName('return')[0]->getType()->getFqsen()->getName();
146
-
147
-        foreach ($params as $param) {
148
-            $name = $param->getVariableName();
149
-            if ($name == 'perPage') {
150
-                $route['parametars'][$name] = 'perPage? number of records per page default 15';
151
-            } elseif ($name == 'sortBy') {
152
-                $route['parametars'][$name] = 'sortBy? sort column default created_at';
153
-            } elseif ($name == 'desc') {
154
-                $route['parametars'][$name] = 'desc? sort descending or ascending default is descending';
155
-            } elseif ($name !== 'request') {
156
-                $route['parametars'][$name] = $param->getDescription()->render();
157
-            }
158
-        }
159
-
160
-        if ($route['name'] === 'index') {
161
-            $route['parametars']['perPage'] = 'perPage? number of records per page default 15';
162
-            $route['parametars']['sortBy']  = 'sortBy? sort column default created_at';
163
-            $route['parametars']['desc']    = 'desc? sort descending or ascending default is descending';
164
-            $route['parametars']['trashed'] = 'trashed? retreive trashed or not default not';
165
-        }
166
-    }
167
-
168
-    /**
169
-     * Generate post body for the given route.
170
-     *
171
-     * @param  array  &$route
172
-     * @param  \ReflectionMethod $reflectionMethod
173
-     * @param  string $module
174
-     * @param  string $modelName
175
-     * @return void
176
-     */
177
-    protected function getPostData(&$route, $reflectionMethod, $module, $modelName)
178
-    {
179
-        $parameters = $reflectionMethod->getParameters();
180
-        $className = optional(optional(\Arr::get($parameters, 0))->getType())->getName();
181
-        if ($className) {
182
-            $reflectionClass  = new \ReflectionClass($className);
183
-        } elseif (in_array($reflectionMethod->getName(), ['store', 'update'])) {
184
-            $className = 'App\\Modules\\' . ucfirst($module) . '\\Http\\Requests\\Store'  . ucfirst($modelName);
185
-            $reflectionClass  = new \ReflectionClass($className);
186
-        }
187
-
188
-        if (isset($reflectionClass) && $reflectionClass->hasMethod('rules')) {
189
-            $reflectionMethod = $reflectionClass->getMethod('rules');
190
-            $route['body'] = $reflectionMethod->invoke(new $className);
191
-
192
-            foreach ($route['body'] as &$rule) {
193
-                if (strpos($rule, 'unique')) {
194
-                    $rule = substr($rule, 0, strpos($rule, 'unique') + 6);
195
-                } elseif (strpos($rule, 'exists')) {
196
-                    $rule = substr($rule, 0, strpos($rule, 'exists') - 1);
197
-                }
198
-            }
199
-        }
200
-    }
201
-
202
-    /**
203
-     * Generate application errors.
204
-     *
205
-     * @return array
206
-     */
207
-    protected function getErrors()
208
-    {
209
-        $errors = [];
210
-        foreach (\Module::all() as $module) {
211
-            $nameSpace = 'App\\Modules\\' . $module['basename'];
212
-            $class = $nameSpace . '\\Errors\\'  . $module['basename'] . 'Errors';
213
-            $reflectionClass = new \ReflectionClass($class);
214
-            foreach ($reflectionClass->getMethods() as $method) {
215
-                $methodName       = $method->name;
216
-                $reflectionMethod = $reflectionClass->getMethod($methodName);
217
-                $body             = $this->getMethodBody($reflectionMethod);
218
-
219
-                preg_match('/abort\(([^#]+)\,/iU', $body, $match);
220
-
221
-                if (count($match)) {
222
-                    $errors[$match[1]][] = $methodName;
223
-                }
224
-            }
225
-        }
226
-
227
-        return $errors;
228
-    }
229
-
230
-    /**
231
-     * Get the given method body code.
232
-     *
233
-     * @param  object $reflectionMethod
234
-     * @return string
235
-     */
236
-    protected function getMethodBody($reflectionMethod)
237
-    {
238
-        $filename   = $reflectionMethod->getFileName();
239
-        $start_line = $reflectionMethod->getStartLine() - 1;
240
-        $end_line   = $reflectionMethod->getEndLine();
241
-        $length     = $end_line - $start_line;
242
-        $source     = file($filename);
243
-        $body       = implode("", array_slice($source, $start_line, $length));
244
-        $body       = trim(preg_replace('/\s+/', '', $body));
245
-
246
-        return $body;
247
-    }
248
-
249
-    /**
250
-     * Get example object of all availble models.
251
-     *
252
-     * @param  string $modelName
253
-     * @param  array  $docData
254
-     * @return string
255
-     */
256
-    protected function getModels($modelName, &$docData, $reflectionClass)
257
-    {
258
-        if ($modelName && ! Arr::has($docData['models'], $modelName)) {
259
-            $repo = call_user_func_array("\Core::{$modelName}", []);
260
-            if (! $repo) {
261
-                return;
262
-            }
83
+		$docData['errors']  = $this->getErrors();
84
+		$docData['reports'] = $this->reportService->all();
85
+		\File::put(app_path('Modules/Core/Resources/api.json'), json_encode($docData));
86
+	}
87
+
88
+	/**
89
+	 * Get list of all registered routes.
90
+	 *
91
+	 * @return collection
92
+	 */
93
+	protected function getRoutes()
94
+	{
95
+		return collect(\Route::getRoutes())->map(function ($route) {
96
+			if (strpos($route->uri(), 'api/') !== false) {
97
+				return [
98
+					'method' => $route->methods()[0],
99
+					'uri'    => $route->uri(),
100
+					'action' => $route->getActionName(),
101
+					'prefix' => $route->getPrefix()
102
+				];
103
+			}
104
+			return false;
105
+		})->all();
106
+	}
107
+
108
+	/**
109
+	 * Generate headers for the given route.
110
+	 *
111
+	 * @param  array  &$route
112
+	 * @param  string $method
113
+	 * @param  array  $skipLoginCheck
114
+	 * @return void
115
+	 */
116
+	protected function getHeaders(&$route, $method, $skipLoginCheck)
117
+	{
118
+		$route['headers'] = [
119
+		'Accept'         => 'application/json',
120
+		'Content-Type'   => 'application/json',
121
+		'Accept-Language' => 'The language of the returned data: ar, en or all.',
122
+		'time-zone'       => 'Your locale time zone',
123
+		];
124
+
125
+
126
+		if (! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) {
127
+			$route['headers']['Authorization'] = 'Bearer {token}';
128
+		}
129
+	}
130
+
131
+	/**
132
+	 * Generate description and params for the given route
133
+	 * based on the docblock.
134
+	 *
135
+	 * @param  array  &$route
136
+	 * @param  \ReflectionMethod $reflectionMethod
137
+	 * @return void
138
+	 */
139
+	protected function processDocBlock(&$route, $reflectionMethod)
140
+	{
141
+		$factory                 = \phpDocumentor\Reflection\DocBlockFactory::createInstance();
142
+		$docblock                = $factory->create($reflectionMethod->getDocComment());
143
+		$route['description']    = trim(preg_replace('/\s+/', ' ', $docblock->getSummary()));
144
+		$params                  = $docblock->getTagsByName('param');
145
+		$route['returnDocBlock'] = $docblock->getTagsByName('return')[0]->getType()->getFqsen()->getName();
146
+
147
+		foreach ($params as $param) {
148
+			$name = $param->getVariableName();
149
+			if ($name == 'perPage') {
150
+				$route['parametars'][$name] = 'perPage? number of records per page default 15';
151
+			} elseif ($name == 'sortBy') {
152
+				$route['parametars'][$name] = 'sortBy? sort column default created_at';
153
+			} elseif ($name == 'desc') {
154
+				$route['parametars'][$name] = 'desc? sort descending or ascending default is descending';
155
+			} elseif ($name !== 'request') {
156
+				$route['parametars'][$name] = $param->getDescription()->render();
157
+			}
158
+		}
159
+
160
+		if ($route['name'] === 'index') {
161
+			$route['parametars']['perPage'] = 'perPage? number of records per page default 15';
162
+			$route['parametars']['sortBy']  = 'sortBy? sort column default created_at';
163
+			$route['parametars']['desc']    = 'desc? sort descending or ascending default is descending';
164
+			$route['parametars']['trashed'] = 'trashed? retreive trashed or not default not';
165
+		}
166
+	}
167
+
168
+	/**
169
+	 * Generate post body for the given route.
170
+	 *
171
+	 * @param  array  &$route
172
+	 * @param  \ReflectionMethod $reflectionMethod
173
+	 * @param  string $module
174
+	 * @param  string $modelName
175
+	 * @return void
176
+	 */
177
+	protected function getPostData(&$route, $reflectionMethod, $module, $modelName)
178
+	{
179
+		$parameters = $reflectionMethod->getParameters();
180
+		$className = optional(optional(\Arr::get($parameters, 0))->getType())->getName();
181
+		if ($className) {
182
+			$reflectionClass  = new \ReflectionClass($className);
183
+		} elseif (in_array($reflectionMethod->getName(), ['store', 'update'])) {
184
+			$className = 'App\\Modules\\' . ucfirst($module) . '\\Http\\Requests\\Store'  . ucfirst($modelName);
185
+			$reflectionClass  = new \ReflectionClass($className);
186
+		}
187
+
188
+		if (isset($reflectionClass) && $reflectionClass->hasMethod('rules')) {
189
+			$reflectionMethod = $reflectionClass->getMethod('rules');
190
+			$route['body'] = $reflectionMethod->invoke(new $className);
191
+
192
+			foreach ($route['body'] as &$rule) {
193
+				if (strpos($rule, 'unique')) {
194
+					$rule = substr($rule, 0, strpos($rule, 'unique') + 6);
195
+				} elseif (strpos($rule, 'exists')) {
196
+					$rule = substr($rule, 0, strpos($rule, 'exists') - 1);
197
+				}
198
+			}
199
+		}
200
+	}
201
+
202
+	/**
203
+	 * Generate application errors.
204
+	 *
205
+	 * @return array
206
+	 */
207
+	protected function getErrors()
208
+	{
209
+		$errors = [];
210
+		foreach (\Module::all() as $module) {
211
+			$nameSpace = 'App\\Modules\\' . $module['basename'];
212
+			$class = $nameSpace . '\\Errors\\'  . $module['basename'] . 'Errors';
213
+			$reflectionClass = new \ReflectionClass($class);
214
+			foreach ($reflectionClass->getMethods() as $method) {
215
+				$methodName       = $method->name;
216
+				$reflectionMethod = $reflectionClass->getMethod($methodName);
217
+				$body             = $this->getMethodBody($reflectionMethod);
218
+
219
+				preg_match('/abort\(([^#]+)\,/iU', $body, $match);
220
+
221
+				if (count($match)) {
222
+					$errors[$match[1]][] = $methodName;
223
+				}
224
+			}
225
+		}
226
+
227
+		return $errors;
228
+	}
229
+
230
+	/**
231
+	 * Get the given method body code.
232
+	 *
233
+	 * @param  object $reflectionMethod
234
+	 * @return string
235
+	 */
236
+	protected function getMethodBody($reflectionMethod)
237
+	{
238
+		$filename   = $reflectionMethod->getFileName();
239
+		$start_line = $reflectionMethod->getStartLine() - 1;
240
+		$end_line   = $reflectionMethod->getEndLine();
241
+		$length     = $end_line - $start_line;
242
+		$source     = file($filename);
243
+		$body       = implode("", array_slice($source, $start_line, $length));
244
+		$body       = trim(preg_replace('/\s+/', '', $body));
245
+
246
+		return $body;
247
+	}
248
+
249
+	/**
250
+	 * Get example object of all availble models.
251
+	 *
252
+	 * @param  string $modelName
253
+	 * @param  array  $docData
254
+	 * @return string
255
+	 */
256
+	protected function getModels($modelName, &$docData, $reflectionClass)
257
+	{
258
+		if ($modelName && ! Arr::has($docData['models'], $modelName)) {
259
+			$repo = call_user_func_array("\Core::{$modelName}", []);
260
+			if (! $repo) {
261
+				return;
262
+			}
263 263
             
264
-            $modelClass = get_class($repo->model);
265
-            $model      = factory($modelClass)->make();
266
-
267
-            $property = $reflectionClass->getProperty('modelResource');
268
-            $property->setAccessible(true);
269
-            $modelResource = $property->getValue(\App::make($reflectionClass->getName()));
270
-
271
-            $relations = [];
272
-            $relationMethods = ['hasOne', 'hasMany', 'belongsTo', 'belongsToMany', 'morphToMany', 'morphTo'];
273
-            $reflector = new \ReflectionClass($model);
274
-            foreach ($reflector->getMethods() as $reflectionMethod) {
275
-                $body = $this->getMethodBody($reflectionMethod);
276
-                foreach ($relationMethods as $relationMethod) {
277
-                    $relation = $reflectionMethod->getName();
278
-                    if (strpos($body, '$this->' . $relationMethod) && $relation !== 'morphedByMany') {
279
-                        $relations[] = $relation;
280
-                        break;
281
-                    }
282
-                }
283
-            }
284
-
285
-            $modelResource = new $modelResource($model->load($relations));
286
-            $modelArr      = $modelResource->toArray([]);
287
-
288
-            foreach ($modelArr as $key => $attr) {
289
-                if (is_object($attr) && property_exists($attr, 'resource') && $attr->resource instanceof \Illuminate\Http\Resources\MissingValue) {
290
-                    unset($modelArr[$key]);
291
-                }
292
-            }
293
-
294
-            $docData['models'][$modelName] = json_encode($modelArr, JSON_PRETTY_PRINT);
295
-        }
296
-    }
297
-
298
-    /**
299
-     * Get the route response object type.
300
-     *
301
-     * @param  string $modelName
302
-     * @param  string $method
303
-     * @param  string $returnDocBlock
304
-     * @return array
305
-     */
306
-    protected function getResponseObject($modelName, $method, $returnDocBlock)
307
-    {
308
-        $relations = config('core.relations');
309
-        $relations = Arr::has($relations, $modelName) ? Arr::has($relations[$modelName], $method) ? $relations[$modelName] : false : false;
310
-        $modelName = call_user_func_array("\Core::{$returnDocBlock}", []) ? $returnDocBlock : $modelName;
311
-
312
-        return $relations ? [$modelName => $relations && $relations[$method] ? $relations[$method] : []] : false;
313
-    }
264
+			$modelClass = get_class($repo->model);
265
+			$model      = factory($modelClass)->make();
266
+
267
+			$property = $reflectionClass->getProperty('modelResource');
268
+			$property->setAccessible(true);
269
+			$modelResource = $property->getValue(\App::make($reflectionClass->getName()));
270
+
271
+			$relations = [];
272
+			$relationMethods = ['hasOne', 'hasMany', 'belongsTo', 'belongsToMany', 'morphToMany', 'morphTo'];
273
+			$reflector = new \ReflectionClass($model);
274
+			foreach ($reflector->getMethods() as $reflectionMethod) {
275
+				$body = $this->getMethodBody($reflectionMethod);
276
+				foreach ($relationMethods as $relationMethod) {
277
+					$relation = $reflectionMethod->getName();
278
+					if (strpos($body, '$this->' . $relationMethod) && $relation !== 'morphedByMany') {
279
+						$relations[] = $relation;
280
+						break;
281
+					}
282
+				}
283
+			}
284
+
285
+			$modelResource = new $modelResource($model->load($relations));
286
+			$modelArr      = $modelResource->toArray([]);
287
+
288
+			foreach ($modelArr as $key => $attr) {
289
+				if (is_object($attr) && property_exists($attr, 'resource') && $attr->resource instanceof \Illuminate\Http\Resources\MissingValue) {
290
+					unset($modelArr[$key]);
291
+				}
292
+			}
293
+
294
+			$docData['models'][$modelName] = json_encode($modelArr, JSON_PRETTY_PRINT);
295
+		}
296
+	}
297
+
298
+	/**
299
+	 * Get the route response object type.
300
+	 *
301
+	 * @param  string $modelName
302
+	 * @param  string $method
303
+	 * @param  string $returnDocBlock
304
+	 * @return array
305
+	 */
306
+	protected function getResponseObject($modelName, $method, $returnDocBlock)
307
+	{
308
+		$relations = config('core.relations');
309
+		$relations = Arr::has($relations, $modelName) ? Arr::has($relations[$modelName], $method) ? $relations[$modelName] : false : false;
310
+		$modelName = call_user_func_array("\Core::{$returnDocBlock}", []) ? $returnDocBlock : $modelName;
311
+
312
+		return $relations ? [$modelName => $relations && $relations[$method] ? $relations[$method] : []] : false;
313
+	}
314 314
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      */
93 93
     protected function getRoutes()
94 94
     {
95
-        return collect(\Route::getRoutes())->map(function ($route) {
95
+        return collect(\Route::getRoutes())->map(function($route) {
96 96
             if (strpos($route->uri(), 'api/') !== false) {
97 97
                 return [
98 98
                     'method' => $route->methods()[0],
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         ];
124 124
 
125 125
 
126
-        if (! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) {
126
+        if ( ! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) {
127 127
             $route['headers']['Authorization'] = 'Bearer {token}';
128 128
         }
129 129
     }
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         if ($className) {
182 182
             $reflectionClass  = new \ReflectionClass($className);
183 183
         } elseif (in_array($reflectionMethod->getName(), ['store', 'update'])) {
184
-            $className = 'App\\Modules\\' . ucfirst($module) . '\\Http\\Requests\\Store'  . ucfirst($modelName);
184
+            $className = 'App\\Modules\\'.ucfirst($module).'\\Http\\Requests\\Store'.ucfirst($modelName);
185 185
             $reflectionClass  = new \ReflectionClass($className);
186 186
         }
187 187
 
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
     {
209 209
         $errors = [];
210 210
         foreach (\Module::all() as $module) {
211
-            $nameSpace = 'App\\Modules\\' . $module['basename'];
212
-            $class = $nameSpace . '\\Errors\\'  . $module['basename'] . 'Errors';
211
+            $nameSpace = 'App\\Modules\\'.$module['basename'];
212
+            $class = $nameSpace.'\\Errors\\'.$module['basename'].'Errors';
213 213
             $reflectionClass = new \ReflectionClass($class);
214 214
             foreach ($reflectionClass->getMethods() as $method) {
215 215
                 $methodName       = $method->name;
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
     {
258 258
         if ($modelName && ! Arr::has($docData['models'], $modelName)) {
259 259
             $repo = call_user_func_array("\Core::{$modelName}", []);
260
-            if (! $repo) {
260
+            if ( ! $repo) {
261 261
                 return;
262 262
             }
263 263
             
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
                 $body = $this->getMethodBody($reflectionMethod);
276 276
                 foreach ($relationMethods as $relationMethod) {
277 277
                     $relation = $reflectionMethod->getName();
278
-                    if (strpos($body, '$this->' . $relationMethod) && $relation !== 'morphedByMany') {
278
+                    if (strpos($body, '$this->'.$relationMethod) && $relation !== 'morphedByMany') {
279 279
                         $relations[] = $relation;
280 280
                         break;
281 281
                     }
Please login to merge, or discard this patch.
files/Kernel.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -11,39 +11,39 @@
 block discarded – undo
11 11
 
12 12
 class Kernel extends ConsoleKernel
13 13
 {
14
-    /**
15
-     * The Artisan commands provided by your application.
16
-     *
17
-     * @var array
18
-     */
19
-    protected $commands = [
20
-        GenerateDocCommand::class,
21
-        PassportInstallCommand::class,
22
-        MakeNotificationsCommand::class,
23
-        MakeModuleCommand::class
24
-    ];
14
+	/**
15
+	 * The Artisan commands provided by your application.
16
+	 *
17
+	 * @var array
18
+	 */
19
+	protected $commands = [
20
+		GenerateDocCommand::class,
21
+		PassportInstallCommand::class,
22
+		MakeNotificationsCommand::class,
23
+		MakeModuleCommand::class
24
+	];
25 25
 
26
-    /**
27
-     * Define the application's command schedule.
28
-     *
29
-     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
30
-     * @return void
31
-     */
32
-    protected function schedule(Schedule $schedule)
33
-    {
34
-        // $schedule->command('inspire')
35
-        //          ->hourly();
36
-    }
26
+	/**
27
+	 * Define the application's command schedule.
28
+	 *
29
+	 * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
30
+	 * @return void
31
+	 */
32
+	protected function schedule(Schedule $schedule)
33
+	{
34
+		// $schedule->command('inspire')
35
+		//          ->hourly();
36
+	}
37 37
 
38
-    /**
39
-     * Register the commands for the application.
40
-     *
41
-     * @return void
42
-     */
43
-    protected function commands()
44
-    {
45
-        $this->load(__DIR__.'/Commands');
38
+	/**
39
+	 * Register the commands for the application.
40
+	 *
41
+	 * @return void
42
+	 */
43
+	protected function commands()
44
+	{
45
+		$this->load(__DIR__.'/Commands');
46 46
 
47
-        require base_path('routes/console.php');
48
-    }
47
+		require base_path('routes/console.php');
48
+	}
49 49
 }
Please login to merge, or discard this patch.
src/Modules/Notifications/Notifications/ResetPassword.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -9,43 +9,43 @@
 block discarded – undo
9 9
 
10 10
 class ResetPassword extends Notification implements ShouldQueue
11 11
 {
12
-    use Queueable;
12
+	use Queueable;
13 13
 
14
-    protected $token;
14
+	protected $token;
15 15
 
16
-    /**
17
-     * Init new object.
18
-     *
19
-     * @return  void
20
-     */
21
-    public function __construct($token)
22
-    {
23
-        $this->token = $token;
24
-    }
16
+	/**
17
+	 * Init new object.
18
+	 *
19
+	 * @return  void
20
+	 */
21
+	public function __construct($token)
22
+	{
23
+		$this->token = $token;
24
+	}
25 25
 
26
-    /**
27
-     * Get the notification's delivery channels.
28
-     *
29
-     * @param  mixed  $notifiable
30
-     * @return string[]
31
-     */
32
-    public function via($notifiable)
33
-    {
34
-        return ['mail'];
35
-    }
26
+	/**
27
+	 * Get the notification's delivery channels.
28
+	 *
29
+	 * @param  mixed  $notifiable
30
+	 * @return string[]
31
+	 */
32
+	public function via($notifiable)
33
+	{
34
+		return ['mail'];
35
+	}
36 36
 
37
-    /**
38
-     * Get the mail representation of the notification.
39
-     *
40
-     * @param  mixed  $notifiable
41
-     * @return \Illuminate\Notifications\Messages\MailMessage
42
-     */
43
-    public function toMail($notifiable)
44
-    {
45
-        return (new MailMessage)
46
-            ->subject('Reset passowrd')
47
-            ->line('Reset passowrd')
48
-            ->line('To reset your password click on the button below')
49
-            ->action('Reset password', config('user.reset_password_url').'/'.$this->token);
50
-    }
37
+	/**
38
+	 * Get the mail representation of the notification.
39
+	 *
40
+	 * @param  mixed  $notifiable
41
+	 * @return \Illuminate\Notifications\Messages\MailMessage
42
+	 */
43
+	public function toMail($notifiable)
44
+	{
45
+		return (new MailMessage)
46
+			->subject('Reset passowrd')
47
+			->line('Reset passowrd')
48
+			->line('To reset your password click on the button below')
49
+			->action('Reset password', config('user.reset_password_url').'/'.$this->token);
50
+	}
51 51
 }
Please login to merge, or discard this patch.
src/Modules/Notifications/Notifications/ConfirmEmail.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -9,41 +9,41 @@
 block discarded – undo
9 9
 
10 10
 class ConfirmEmail extends Notification implements ShouldQueue
11 11
 {
12
-    use Queueable;
12
+	use Queueable;
13 13
 
14
-    /**
15
-     * Init new object.
16
-     *
17
-     * @return  void
18
-     */
19
-    public function __construct()
20
-    {
21
-        //
22
-    }
14
+	/**
15
+	 * Init new object.
16
+	 *
17
+	 * @return  void
18
+	 */
19
+	public function __construct()
20
+	{
21
+		//
22
+	}
23 23
 
24
-    /**
25
-     * Get the notification's delivery channels.
26
-     *
27
-     * @param  mixed  $notifiable
28
-     * @return string[]
29
-     */
30
-    public function via($notifiable)
31
-    {
32
-        return ['mail'];
33
-    }
24
+	/**
25
+	 * Get the notification's delivery channels.
26
+	 *
27
+	 * @param  mixed  $notifiable
28
+	 * @return string[]
29
+	 */
30
+	public function via($notifiable)
31
+	{
32
+		return ['mail'];
33
+	}
34 34
 
35
-    /**
36
-     * Get the mail representation of the notification.
37
-     *
38
-     * @param  mixed  $notifiable
39
-     * @return \Illuminate\Notifications\Messages\MailMessage
40
-     */
41
-    public function toMail($notifiable)
42
-    {
43
-        return (new MailMessage)
44
-            ->subject('Email verification')
45
-            ->line('Email verification')
46
-            ->line('To validate your email click on the button below')
47
-            ->action('Verify your email', config('user.confrim_email_url').'/'.$notifiable->confirmation_code);
48
-    }
35
+	/**
36
+	 * Get the mail representation of the notification.
37
+	 *
38
+	 * @param  mixed  $notifiable
39
+	 * @return \Illuminate\Notifications\Messages\MailMessage
40
+	 */
41
+	public function toMail($notifiable)
42
+	{
43
+		return (new MailMessage)
44
+			->subject('Email verification')
45
+			->line('Email verification')
46
+			->line('To validate your email click on the button below')
47
+			->action('Verify your email', config('user.confrim_email_url').'/'.$notifiable->confirmation_code);
48
+	}
49 49
 }
Please login to merge, or discard this patch.
files/Handler.php 3 patches
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 namespace App\Exceptions;
4 4
 
5
-use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
5
+use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
6 6
 use Throwable;
7 7
 
8 8
 class Handler extends ExceptionHandler
Please login to merge, or discard this patch.
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -7,69 +7,69 @@
 block discarded – undo
7 7
 
8 8
 class Handler extends ExceptionHandler
9 9
 {
10
-    /**
11
-     * A list of the exception types that are not reported.
12
-     *
13
-     * @var array
14
-     */
15
-    protected $dontReport = [
16
-        \League\OAuth2\Server\Exception\OAuthServerException::class,
17
-    ];
10
+	/**
11
+	 * A list of the exception types that are not reported.
12
+	 *
13
+	 * @var array
14
+	 */
15
+	protected $dontReport = [
16
+		\League\OAuth2\Server\Exception\OAuthServerException::class,
17
+	];
18 18
 
19
-    /**
20
-     * A list of the inputs that are never flashed for validation exceptions.
21
-     *
22
-     * @var array
23
-     */
24
-    protected $dontFlash = [
25
-        'password',
26
-        'password_confirmation',
27
-    ];
19
+	/**
20
+	 * A list of the inputs that are never flashed for validation exceptions.
21
+	 *
22
+	 * @var array
23
+	 */
24
+	protected $dontFlash = [
25
+		'password',
26
+		'password_confirmation',
27
+	];
28 28
 
29
-    /**
30
-     * Report or log an exception.
31
-     *
32
-     * @param  \Throwable  $exception
33
-     * @return void
34
-     *
35
-     * @throws \Exception
36
-     */
37
-    public function report(Throwable $exception)
38
-    {
39
-        parent::report($exception);
40
-    }
29
+	/**
30
+	 * Report or log an exception.
31
+	 *
32
+	 * @param  \Throwable  $exception
33
+	 * @return void
34
+	 *
35
+	 * @throws \Exception
36
+	 */
37
+	public function report(Throwable $exception)
38
+	{
39
+		parent::report($exception);
40
+	}
41 41
 
42
-    /**
43
-     * Render an exception into an HTTP response.
44
-     *
45
-     * @param  \Illuminate\Http\Request  $request
46
-     * @param  \Throwable  $exception
47
-     * @return \Symfony\Component\HttpFoundation\Response
48
-     *
49
-     * @throws \Throwable
50
-     */
51
-    public function render($request, Throwable $exception)
52
-    {
53
-        if ($request->wantsJson()) {
54
-            if ($exception instanceof \Illuminate\Auth\AuthenticationException) {
55
-                \Errors::unAuthorized();
56
-            }
57
-            if ($exception instanceof \Illuminate\Database\QueryException) {
58
-                \Errors::dbQueryError();
59
-            } elseif ($exception instanceof \predis\connection\connectionexception) {
60
-                \Errors::redisNotRunning();
61
-            } elseif ($exception instanceof \GuzzleHttp\Exception\ClientException) {
62
-                \Errors::connectionError();
63
-            } elseif ($exception instanceof \Symfony\Component\HttpKernel\Exception\HttpException) {
64
-                $errors = $exception-> getStatusCode() === 404 ? 'not found' : $exception-> getMessage();
65
-                return \Response::json(['errors' => [$errors]], $exception-> getStatusCode());
66
-            } elseif ($exception instanceof \Illuminate\Validation\ValidationException) {
67
-                return \Response::json(['errors' => $exception-> errors()], 422);
68
-            } elseif (! $exception instanceof \Symfony\Component\ErrorHandler\Error\FatalError) {
69
-                return parent::render($request, $exception);
70
-            }
71
-        }
42
+	/**
43
+	 * Render an exception into an HTTP response.
44
+	 *
45
+	 * @param  \Illuminate\Http\Request  $request
46
+	 * @param  \Throwable  $exception
47
+	 * @return \Symfony\Component\HttpFoundation\Response
48
+	 *
49
+	 * @throws \Throwable
50
+	 */
51
+	public function render($request, Throwable $exception)
52
+	{
53
+		if ($request->wantsJson()) {
54
+			if ($exception instanceof \Illuminate\Auth\AuthenticationException) {
55
+				\Errors::unAuthorized();
56
+			}
57
+			if ($exception instanceof \Illuminate\Database\QueryException) {
58
+				\Errors::dbQueryError();
59
+			} elseif ($exception instanceof \predis\connection\connectionexception) {
60
+				\Errors::redisNotRunning();
61
+			} elseif ($exception instanceof \GuzzleHttp\Exception\ClientException) {
62
+				\Errors::connectionError();
63
+			} elseif ($exception instanceof \Symfony\Component\HttpKernel\Exception\HttpException) {
64
+				$errors = $exception-> getStatusCode() === 404 ? 'not found' : $exception-> getMessage();
65
+				return \Response::json(['errors' => [$errors]], $exception-> getStatusCode());
66
+			} elseif ($exception instanceof \Illuminate\Validation\ValidationException) {
67
+				return \Response::json(['errors' => $exception-> errors()], 422);
68
+			} elseif (! $exception instanceof \Symfony\Component\ErrorHandler\Error\FatalError) {
69
+				return parent::render($request, $exception);
70
+			}
71
+		}
72 72
         
73
-        return parent::render($request, $exception);
74
-    }
73
+		return parent::render($request, $exception);
74
+	}
75 75
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
                 return \Response::json(['errors' => [$errors]], $exception-> getStatusCode());
66 66
             } elseif ($exception instanceof \Illuminate\Validation\ValidationException) {
67 67
                 return \Response::json(['errors' => $exception-> errors()], 422);
68
-            } elseif (! $exception instanceof \Symfony\Component\ErrorHandler\Error\FatalError) {
68
+            } elseif ( ! $exception instanceof \Symfony\Component\ErrorHandler\Error\FatalError) {
69 69
                 return parent::render($request, $exception);
70 70
             }
71 71
         }
Please login to merge, or discard this patch.
src/Modules/OauthClients/Providers/ModuleServiceProvider.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -6,30 +6,30 @@
 block discarded – undo
6 6
 
7 7
 class ModuleServiceProvider extends ServiceProvider
8 8
 {
9
-    /**
10
-     * Bootstrap the module services.
11
-     *
12
-     * @return void
13
-     */
14
-    public function boot()
15
-    {
16
-        $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'oauth-clients');
17
-        $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'oauth-clients');
9
+	/**
10
+	 * Bootstrap the module services.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function boot()
15
+	{
16
+		$this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'oauth-clients');
17
+		$this->loadViewsFrom(__DIR__.'/../Resources/Views', 'oauth-clients');
18 18
 
19
-        $this->loadMigrationsFrom(module_path('oauth-clients', 'Database/Migrations', 'app'));
20
-        $this->loadFactoriesFrom(module_path('oauth-clients', 'Database/Factories', 'app'));
21
-        if (!$this->app->configurationIsCached()) {
22
-            $this->loadConfigsFrom(module_path('oauth-clients', 'Config', 'app'));
23
-        }
24
-    }
19
+		$this->loadMigrationsFrom(module_path('oauth-clients', 'Database/Migrations', 'app'));
20
+		$this->loadFactoriesFrom(module_path('oauth-clients', 'Database/Factories', 'app'));
21
+		if (!$this->app->configurationIsCached()) {
22
+			$this->loadConfigsFrom(module_path('oauth-clients', 'Config', 'app'));
23
+		}
24
+	}
25 25
 
26
-    /**
27
-     * Register the module services.
28
-     *
29
-     * @return void
30
-     */
31
-    public function register()
32
-    {
33
-        $this->app->register(RouteServiceProvider::class);
34
-    }
26
+	/**
27
+	 * Register the module services.
28
+	 *
29
+	 * @return void
30
+	 */
31
+	public function register()
32
+	{
33
+		$this->app->register(RouteServiceProvider::class);
34
+	}
35 35
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 
19 19
         $this->loadMigrationsFrom(module_path('oauth-clients', 'Database/Migrations', 'app'));
20 20
         $this->loadFactoriesFrom(module_path('oauth-clients', 'Database/Factories', 'app'));
21
-        if (!$this->app->configurationIsCached()) {
21
+        if ( ! $this->app->configurationIsCached()) {
22 22
             $this->loadConfigsFrom(module_path('oauth-clients', 'Config', 'app'));
23 23
         }
24 24
     }
Please login to merge, or discard this patch.