Completed
Push — master ( a38508...8df45b )
by Sherif
02:18
created
src/Modules/Core/Utl/Media.php 1 patch
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -2,62 +2,62 @@
 block discarded – undo
2 2
 
3 3
 class Media
4 4
 {
5
-    /**
6
-     * Upload the given image.
7
-     *
8
-     * @param  object  $image
9
-     * @param  string  $dir
10
-     * @return string
11
-     */
12
-    public function uploadImage($image, $dir)
13
-    {
14
-        $image = \Image::make($image);
15
-        return $this->saveImage($image, $dir);
16
-    }
5
+	/**
6
+	 * Upload the given image.
7
+	 *
8
+	 * @param  object  $image
9
+	 * @param  string  $dir
10
+	 * @return string
11
+	 */
12
+	public function uploadImage($image, $dir)
13
+	{
14
+		$image = \Image::make($image);
15
+		return $this->saveImage($image, $dir);
16
+	}
17 17
 
18
-    /**
19
-     * Upload the given image.
20
-     *
21
-     * @param  object  $image
22
-     * @param  string  $dir
23
-     * @return string
24
-     */
25
-    public function uploadImageBas64($image, $dir)
26
-    {
27
-        if (! strlen($image)) {
28
-            return null;
29
-        }
18
+	/**
19
+	 * Upload the given image.
20
+	 *
21
+	 * @param  object  $image
22
+	 * @param  string  $dir
23
+	 * @return string
24
+	 */
25
+	public function uploadImageBas64($image, $dir)
26
+	{
27
+		if (! strlen($image)) {
28
+			return null;
29
+		}
30 30
 
31
-        $base  = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $image));
32
-        $image = \Image::make($base);
31
+		$base  = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $image));
32
+		$image = \Image::make($base);
33 33
 
34
-        return $this->saveImage($image, $dir);
35
-    }
34
+		return $this->saveImage($image, $dir);
35
+	}
36 36
 
37
-    /**
38
-     * Delete the given image.
39
-     *
40
-     * @param  object $path
41
-     * @return void
42
-     */
43
-    public function deleteImage($path)
44
-    {
45
-        \Storage::delete($path);
46
-    }
37
+	/**
38
+	 * Delete the given image.
39
+	 *
40
+	 * @param  object $path
41
+	 * @return void
42
+	 */
43
+	public function deleteImage($path)
44
+	{
45
+		\Storage::delete($path);
46
+	}
47 47
 
48
-    /**
49
-     * Save the given image.
50
-     *
51
-     * @param  object  $image
52
-     * @param  string  $dir
53
-     * @return string
54
-     */
55
-    protected function saveImage($image, $dir)
56
-    {
57
-        $imageName = 'image'.uniqid().time().'.jpg';
58
-        $path      = 'public'.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.$imageName;
59
-        \Storage::put($path, $image->stream());
48
+	/**
49
+	 * Save the given image.
50
+	 *
51
+	 * @param  object  $image
52
+	 * @param  string  $dir
53
+	 * @return string
54
+	 */
55
+	protected function saveImage($image, $dir)
56
+	{
57
+		$imageName = 'image'.uniqid().time().'.jpg';
58
+		$path      = 'public'.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.$imageName;
59
+		\Storage::put($path, $image->stream());
60 60
 
61
-        return $path;
62
-    }
61
+		return $path;
62
+	}
63 63
 }
Please login to merge, or discard this patch.
src/Modules/Core/Utl/ErrorHandler.php 1 patch
Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -2,123 +2,123 @@
 block discarded – undo
2 2
 
3 3
 class ErrorHandler
4 4
 {
5
-    public function unAuthorized()
6
-    {
7
-        $error = ['status' => 401, 'message' => trans('core::errors.unAuthorized')];
8
-        abort($error['status'], $error['message']);
9
-    }
10
-
11
-    public function invalidRefreshToken()
12
-    {
13
-        $error = ['status' => 400, 'message' => trans('core::errors.invalidRefreshToken')];
14
-        abort($error['status'], $error['message']);
15
-    }
16
-
17
-    public function noPermissions()
18
-    {
19
-        $error = ['status' => 403, 'message' => trans('core::errors.noPermissions')];
20
-        abort($error['status'], $error['message']);
21
-    }
22
-
23
-    public function loginFailed()
24
-    {
25
-        $error = ['status' => 400, 'message' => trans('core::errors.loginFailed')];
26
-        abort($error['status'], $error['message']);
27
-    }
28
-
29
-    public function noSocialEmail()
30
-    {
31
-        $error = ['status' => 400, 'message' => trans('core::errors.noSocialEmail')];
32
-        abort($error['status'], $error['message']);
33
-    }
34
-
35
-    public function userAlreadyRegistered()
36
-    {
37
-        $error = ['status' => 400, 'message' => trans('core::errors.userAlreadyRegistered')];
38
-        abort($error['status'], $error['message']);
39
-    }
40
-
41
-    public function connectionError()
42
-    {
43
-        $error = ['status' => 400, 'message' => trans('core::errors.connectionError')];
44
-        abort($error['status'], $error['message']);
45
-    }
46
-
47
-    public function redisNotRunning()
48
-    {
49
-        $error = ['status' => 400, 'message' => trans('core::errors.redisNotRunning')];
50
-        abort($error['status'], $error['message']);
51
-    }
52
-
53
-    public function dbQueryError()
54
-    {
55
-        $error = ['status' => 400, 'message' => trans('core::errors.dbQueryError')];
56
-        abort($error['status'], $error['message']);
57
-    }
58
-
59
-    public function cannotCreateSetting()
60
-    {
61
-        $error = ['status' => 400, 'message' => trans('core::errors.cannotCreateSetting')];
62
-        abort($error['status'], $error['message']);
63
-    }
64
-
65
-    public function cannotUpdateSettingKey()
66
-    {
67
-        $error = ['status' => 400, 'message' => trans('core::errors.cannotUpdateSettingKey')];
68
-        abort($error['status'], $error['message']);
69
-    }
70
-
71
-    public function userIsBlocked()
72
-    {
73
-        $error = ['status' => 403, 'message' => trans('core::errors.userIsBlocked')];
74
-        abort($error['status'], $error['message']);
75
-    }
76
-
77
-    public function emailNotConfirmed()
78
-    {
79
-        $error = ['status' => 403, 'message' => trans('core::errors.emailNotConfirmed')];
80
-        abort($error['status'], $error['message']);
81
-    }
82
-
83
-    public function emailAlreadyConfirmed()
84
-    {
85
-        $error = ['status' => 403, 'message' => trans('core::errors.emailAlreadyConfirmed')];
86
-        abort($error['status'], $error['message']);
87
-    }
88
-
89
-    public function invalidResetToken()
90
-    {
91
-        $error = ['status' => 400, 'message' => trans('core::errors.invalidResetToken')];
92
-        abort($error['status'], $error['message']);
93
-    }
94
-
95
-    public function invalidResetPassword()
96
-    {
97
-        $error = ['status' => 400, 'message' => trans('core::errors.invalidResetPassword')];
98
-        abort($error['status'], $error['message']);
99
-    }
100
-
101
-    public function invalidOldPassword()
102
-    {
103
-        $error = ['status' => 400, 'message' => trans('core::errors.invalidOldPassword')];
104
-        abort($error['status'], $error['message']);
105
-    }
106
-
107
-    public function invalidConfirmationCode()
108
-    {
109
-        $error = ['status' => 400, 'message' => trans('core::errors.invalidConfirmationCode')];
110
-        abort($error['status'], $error['message']);
111
-    }
112
-
113
-    public function notFound($text)
114
-    {
115
-        $error = ['status' => 404, 'message' => trans('core::errors.notFound', ['replace' => $text])];
116
-        abort($error['status'], $error['message']);
117
-    }
118
-
119
-    public function generalError()
120
-    {
121
-        $error = ['status' => 400, 'message' => trans('core::errors.generalError')];
122
-        abort($error['status'], $error['message']);
123
-    }
5
+	public function unAuthorized()
6
+	{
7
+		$error = ['status' => 401, 'message' => trans('core::errors.unAuthorized')];
8
+		abort($error['status'], $error['message']);
9
+	}
10
+
11
+	public function invalidRefreshToken()
12
+	{
13
+		$error = ['status' => 400, 'message' => trans('core::errors.invalidRefreshToken')];
14
+		abort($error['status'], $error['message']);
15
+	}
16
+
17
+	public function noPermissions()
18
+	{
19
+		$error = ['status' => 403, 'message' => trans('core::errors.noPermissions')];
20
+		abort($error['status'], $error['message']);
21
+	}
22
+
23
+	public function loginFailed()
24
+	{
25
+		$error = ['status' => 400, 'message' => trans('core::errors.loginFailed')];
26
+		abort($error['status'], $error['message']);
27
+	}
28
+
29
+	public function noSocialEmail()
30
+	{
31
+		$error = ['status' => 400, 'message' => trans('core::errors.noSocialEmail')];
32
+		abort($error['status'], $error['message']);
33
+	}
34
+
35
+	public function userAlreadyRegistered()
36
+	{
37
+		$error = ['status' => 400, 'message' => trans('core::errors.userAlreadyRegistered')];
38
+		abort($error['status'], $error['message']);
39
+	}
40
+
41
+	public function connectionError()
42
+	{
43
+		$error = ['status' => 400, 'message' => trans('core::errors.connectionError')];
44
+		abort($error['status'], $error['message']);
45
+	}
46
+
47
+	public function redisNotRunning()
48
+	{
49
+		$error = ['status' => 400, 'message' => trans('core::errors.redisNotRunning')];
50
+		abort($error['status'], $error['message']);
51
+	}
52
+
53
+	public function dbQueryError()
54
+	{
55
+		$error = ['status' => 400, 'message' => trans('core::errors.dbQueryError')];
56
+		abort($error['status'], $error['message']);
57
+	}
58
+
59
+	public function cannotCreateSetting()
60
+	{
61
+		$error = ['status' => 400, 'message' => trans('core::errors.cannotCreateSetting')];
62
+		abort($error['status'], $error['message']);
63
+	}
64
+
65
+	public function cannotUpdateSettingKey()
66
+	{
67
+		$error = ['status' => 400, 'message' => trans('core::errors.cannotUpdateSettingKey')];
68
+		abort($error['status'], $error['message']);
69
+	}
70
+
71
+	public function userIsBlocked()
72
+	{
73
+		$error = ['status' => 403, 'message' => trans('core::errors.userIsBlocked')];
74
+		abort($error['status'], $error['message']);
75
+	}
76
+
77
+	public function emailNotConfirmed()
78
+	{
79
+		$error = ['status' => 403, 'message' => trans('core::errors.emailNotConfirmed')];
80
+		abort($error['status'], $error['message']);
81
+	}
82
+
83
+	public function emailAlreadyConfirmed()
84
+	{
85
+		$error = ['status' => 403, 'message' => trans('core::errors.emailAlreadyConfirmed')];
86
+		abort($error['status'], $error['message']);
87
+	}
88
+
89
+	public function invalidResetToken()
90
+	{
91
+		$error = ['status' => 400, 'message' => trans('core::errors.invalidResetToken')];
92
+		abort($error['status'], $error['message']);
93
+	}
94
+
95
+	public function invalidResetPassword()
96
+	{
97
+		$error = ['status' => 400, 'message' => trans('core::errors.invalidResetPassword')];
98
+		abort($error['status'], $error['message']);
99
+	}
100
+
101
+	public function invalidOldPassword()
102
+	{
103
+		$error = ['status' => 400, 'message' => trans('core::errors.invalidOldPassword')];
104
+		abort($error['status'], $error['message']);
105
+	}
106
+
107
+	public function invalidConfirmationCode()
108
+	{
109
+		$error = ['status' => 400, 'message' => trans('core::errors.invalidConfirmationCode')];
110
+		abort($error['status'], $error['message']);
111
+	}
112
+
113
+	public function notFound($text)
114
+	{
115
+		$error = ['status' => 404, 'message' => trans('core::errors.notFound', ['replace' => $text])];
116
+		abort($error['status'], $error['message']);
117
+	}
118
+
119
+	public function generalError()
120
+	{
121
+		$error = ['status' => 400, 'message' => trans('core::errors.generalError')];
122
+		abort($error['status'], $error['message']);
123
+	}
124 124
 }
Please login to merge, or discard this patch.
src/Modules/Core/Utl/ApiConsumer.php 1 patch
Indentation   +214 added lines, -214 removed lines patch added patch discarded remove patch
@@ -7,218 +7,218 @@
 block discarded – undo
7 7
 class ApiConsumer
8 8
 {
9 9
 
10
-    private $app;
11
-
12
-    private $router;
13
-
14
-    private $request;
15
-
16
-    private $disableMiddleware = false;
17
-
18
-    /**
19
-     * @param \Illuminate\Foundation\Application $app
20
-     * @param \Illuminate\Http\Request $request,
21
-     * @param \Illuminate\Routing\Router $router
22
-     */
23
-    public function __construct(Application $app, Request $request, LaravelRouter $router)
24
-    {
25
-        $this->app = $app;
26
-        $this->request = $request;
27
-        $this->router = $router;
28
-    }
29
-
30
-    /**
31
-     * @param  string $uri
32
-     * @param  array  $data
33
-     * @param  array  $headers
34
-     * @param  string $content
35
-     * @return \Illuminate\Http\Response
36
-     */
37
-    public function get()
38
-    {
39
-        return $this->quickCall('GET', func_get_args());
40
-    }
41
-
42
-    /**
43
-     * @param  string $uri
44
-     * @param  array  $data
45
-     * @param  array  $headers
46
-     * @param  string $content
47
-     * @return \Illuminate\Http\Response
48
-     */
49
-    public function post()
50
-    {
51
-        return $this->quickCall('POST', func_get_args());
52
-    }
53
-
54
-    /**
55
-     * @param  string $uri
56
-     * @param  array  $data
57
-     * @param  array  $headers
58
-     * @param  string $content
59
-     * @return \Illuminate\Http\Response
60
-     */
61
-    public function put()
62
-    {
63
-        return $this->quickCall('PUT', func_get_args());
64
-    }
65
-
66
-    /**
67
-     * @param  string $uri
68
-     * @param  array  $data
69
-     * @param  array  $headers
70
-     * @param  string $content
71
-     * @return \Illuminate\Http\Response
72
-     */
73
-    public function delete()
74
-    {
75
-        return $this->quickCall('DELETE', func_get_args());
76
-    }
77
-
78
-    /**
79
-     * @param  array $requests An array of requests
80
-     * @return array
81
-     */
82
-    public function batchRequest(array $requests)
83
-    {
84
-        foreach ($requests as $i => $request) {
85
-            $requests[$i] = call_user_func_array([$this, 'singleRequest'], $request);
86
-        }
87
-
88
-        return $requests;
89
-    }
90
-
91
-    /**
92
-     * @param  string $method
93
-     * @param  array  $args
94
-     * @return \Illuminate\Http\Response
95
-     */
96
-    public function quickCall($method, array $args)
97
-    {
98
-        array_unshift($args, $method);
99
-        return call_user_func_array([$this, "singleRequest"], $args);
100
-    }
101
-
102
-    /**
103
-     * @param  string $method
104
-     * @param  string $uri
105
-     * @param  array  $data
106
-     * @param  array  $headers
107
-     * @param  string $content
108
-     * @return \Illuminate\Http\Response
109
-     */
110
-    public function singleRequest($method, $uri, array $data = [], array $headers = [], $content = null)
111
-    {
112
-        // Save the current request so we can reset the router back to it
113
-        // after we've completed our internal request.
114
-        $currentRequest = $this->request->instance()->duplicate();
115
-
116
-        $headers = $this->overrideHeaders($currentRequest->server->getHeaders(), $headers);
117
-
118
-        if ($this->disableMiddleware) {
119
-            $this->app->instance('middleware.disable', true);
120
-        }
121
-
122
-        $response = $this->request($method, $uri, $data, $headers, $content);
123
-
124
-        if ($this->disableMiddleware) {
125
-            $this->app->instance('middleware.disable', false);
126
-        }
127
-
128
-        // Once the request has completed we reset the currentRequest of the router
129
-        // to match the original request.
130
-        $this->request->instance()->initialize(
131
-            $currentRequest->query->all(),
132
-            $currentRequest->request->all(),
133
-            $currentRequest->attributes->all(),
134
-            $currentRequest->cookies->all(),
135
-            $currentRequest->files->all(),
136
-            $currentRequest->server->all(),
137
-            $currentRequest->content
138
-        );
139
-
140
-        return $response;
141
-    }
142
-
143
-    private function overrideHeaders(array $default, array $headers)
144
-    {
145
-        $headers = $this->transformHeadersToUppercaseUnderscoreType($headers);
146
-        return array_merge($default, $headers);
147
-    }
148
-
149
-    public function enableMiddleware()
150
-    {
151
-        $this->disableMiddleware = false;
152
-    }
153
-
154
-    public function disableMiddleware()
155
-    {
156
-        $this->disableMiddleware = true;
157
-    }
158
-
159
-    /**
160
-     * @param  string $method
161
-     * @param  string $uri
162
-     * @param  array  $data
163
-     * @param  array  $headers
164
-     * @param  string $content
165
-     * @return \Illuminate\Http\Response
166
-     */
167
-    private function request($method, $uri, array $data = [], array $headers = [], $content = null)
168
-    {
169
-        // Create a new request object for the internal request
170
-        $request = $this->createRequest($method, $uri, $data, $headers, $content);
171
-
172
-        // Handle the request in the kernel and prepare a response
173
-        $response = $this->router->prepareResponse($request, $this->app->handle($request));
174
-
175
-        return $response;
176
-    }
177
-
178
-    /**
179
-     * @param  string $method
180
-     * @param  string $uri
181
-     * @param  array  $data
182
-     * @param  array  $headers
183
-     * @param  string $content
184
-     * @return \Illuminate\Http\Request
185
-     */
186
-    private function createRequest($method, $uri, array $data = [], array $headers = [], $content = null)
187
-    {
188
-        $server = $this->transformHeadersToServerVariables($headers);
189
-
190
-        return $this->request->create($uri, $method, $data, [], [], $server, $content);
191
-    }
192
-
193
-    private function transformHeadersToUppercaseUnderscoreType($headers)
194
-    {
195
-        $transformed = [];
196
-
197
-        foreach ($headers as $headerType => $headerValue) {
198
-            $headerType = strtoupper(str_replace('-', '_', $headerType));
199
-
200
-            $transformed[$headerType] = $headerValue;
201
-        }
202
-
203
-        return $transformed;
204
-    }
205
-
206
-    /**
207
-     * https://github.com/symfony/symfony/issues/5074
208
-     *
209
-     * @param  array $headers
210
-     * @return array
211
-     */
212
-    private function transformHeadersToServerVariables($headers)
213
-    {
214
-        $server = [];
215
-
216
-        foreach ($headers as $headerType => $headerValue) {
217
-            $headerType = 'HTTP_' . $headerType;
218
-
219
-            $server[$headerType] = $headerValue;
220
-        }
221
-
222
-        return $server;
223
-    }
10
+	private $app;
11
+
12
+	private $router;
13
+
14
+	private $request;
15
+
16
+	private $disableMiddleware = false;
17
+
18
+	/**
19
+	 * @param \Illuminate\Foundation\Application $app
20
+	 * @param \Illuminate\Http\Request $request,
21
+	 * @param \Illuminate\Routing\Router $router
22
+	 */
23
+	public function __construct(Application $app, Request $request, LaravelRouter $router)
24
+	{
25
+		$this->app = $app;
26
+		$this->request = $request;
27
+		$this->router = $router;
28
+	}
29
+
30
+	/**
31
+	 * @param  string $uri
32
+	 * @param  array  $data
33
+	 * @param  array  $headers
34
+	 * @param  string $content
35
+	 * @return \Illuminate\Http\Response
36
+	 */
37
+	public function get()
38
+	{
39
+		return $this->quickCall('GET', func_get_args());
40
+	}
41
+
42
+	/**
43
+	 * @param  string $uri
44
+	 * @param  array  $data
45
+	 * @param  array  $headers
46
+	 * @param  string $content
47
+	 * @return \Illuminate\Http\Response
48
+	 */
49
+	public function post()
50
+	{
51
+		return $this->quickCall('POST', func_get_args());
52
+	}
53
+
54
+	/**
55
+	 * @param  string $uri
56
+	 * @param  array  $data
57
+	 * @param  array  $headers
58
+	 * @param  string $content
59
+	 * @return \Illuminate\Http\Response
60
+	 */
61
+	public function put()
62
+	{
63
+		return $this->quickCall('PUT', func_get_args());
64
+	}
65
+
66
+	/**
67
+	 * @param  string $uri
68
+	 * @param  array  $data
69
+	 * @param  array  $headers
70
+	 * @param  string $content
71
+	 * @return \Illuminate\Http\Response
72
+	 */
73
+	public function delete()
74
+	{
75
+		return $this->quickCall('DELETE', func_get_args());
76
+	}
77
+
78
+	/**
79
+	 * @param  array $requests An array of requests
80
+	 * @return array
81
+	 */
82
+	public function batchRequest(array $requests)
83
+	{
84
+		foreach ($requests as $i => $request) {
85
+			$requests[$i] = call_user_func_array([$this, 'singleRequest'], $request);
86
+		}
87
+
88
+		return $requests;
89
+	}
90
+
91
+	/**
92
+	 * @param  string $method
93
+	 * @param  array  $args
94
+	 * @return \Illuminate\Http\Response
95
+	 */
96
+	public function quickCall($method, array $args)
97
+	{
98
+		array_unshift($args, $method);
99
+		return call_user_func_array([$this, "singleRequest"], $args);
100
+	}
101
+
102
+	/**
103
+	 * @param  string $method
104
+	 * @param  string $uri
105
+	 * @param  array  $data
106
+	 * @param  array  $headers
107
+	 * @param  string $content
108
+	 * @return \Illuminate\Http\Response
109
+	 */
110
+	public function singleRequest($method, $uri, array $data = [], array $headers = [], $content = null)
111
+	{
112
+		// Save the current request so we can reset the router back to it
113
+		// after we've completed our internal request.
114
+		$currentRequest = $this->request->instance()->duplicate();
115
+
116
+		$headers = $this->overrideHeaders($currentRequest->server->getHeaders(), $headers);
117
+
118
+		if ($this->disableMiddleware) {
119
+			$this->app->instance('middleware.disable', true);
120
+		}
121
+
122
+		$response = $this->request($method, $uri, $data, $headers, $content);
123
+
124
+		if ($this->disableMiddleware) {
125
+			$this->app->instance('middleware.disable', false);
126
+		}
127
+
128
+		// Once the request has completed we reset the currentRequest of the router
129
+		// to match the original request.
130
+		$this->request->instance()->initialize(
131
+			$currentRequest->query->all(),
132
+			$currentRequest->request->all(),
133
+			$currentRequest->attributes->all(),
134
+			$currentRequest->cookies->all(),
135
+			$currentRequest->files->all(),
136
+			$currentRequest->server->all(),
137
+			$currentRequest->content
138
+		);
139
+
140
+		return $response;
141
+	}
142
+
143
+	private function overrideHeaders(array $default, array $headers)
144
+	{
145
+		$headers = $this->transformHeadersToUppercaseUnderscoreType($headers);
146
+		return array_merge($default, $headers);
147
+	}
148
+
149
+	public function enableMiddleware()
150
+	{
151
+		$this->disableMiddleware = false;
152
+	}
153
+
154
+	public function disableMiddleware()
155
+	{
156
+		$this->disableMiddleware = true;
157
+	}
158
+
159
+	/**
160
+	 * @param  string $method
161
+	 * @param  string $uri
162
+	 * @param  array  $data
163
+	 * @param  array  $headers
164
+	 * @param  string $content
165
+	 * @return \Illuminate\Http\Response
166
+	 */
167
+	private function request($method, $uri, array $data = [], array $headers = [], $content = null)
168
+	{
169
+		// Create a new request object for the internal request
170
+		$request = $this->createRequest($method, $uri, $data, $headers, $content);
171
+
172
+		// Handle the request in the kernel and prepare a response
173
+		$response = $this->router->prepareResponse($request, $this->app->handle($request));
174
+
175
+		return $response;
176
+	}
177
+
178
+	/**
179
+	 * @param  string $method
180
+	 * @param  string $uri
181
+	 * @param  array  $data
182
+	 * @param  array  $headers
183
+	 * @param  string $content
184
+	 * @return \Illuminate\Http\Request
185
+	 */
186
+	private function createRequest($method, $uri, array $data = [], array $headers = [], $content = null)
187
+	{
188
+		$server = $this->transformHeadersToServerVariables($headers);
189
+
190
+		return $this->request->create($uri, $method, $data, [], [], $server, $content);
191
+	}
192
+
193
+	private function transformHeadersToUppercaseUnderscoreType($headers)
194
+	{
195
+		$transformed = [];
196
+
197
+		foreach ($headers as $headerType => $headerValue) {
198
+			$headerType = strtoupper(str_replace('-', '_', $headerType));
199
+
200
+			$transformed[$headerType] = $headerValue;
201
+		}
202
+
203
+		return $transformed;
204
+	}
205
+
206
+	/**
207
+	 * https://github.com/symfony/symfony/issues/5074
208
+	 *
209
+	 * @param  array $headers
210
+	 * @return array
211
+	 */
212
+	private function transformHeadersToServerVariables($headers)
213
+	{
214
+		$server = [];
215
+
216
+		foreach ($headers as $headerType => $headerValue) {
217
+			$headerType = 'HTTP_' . $headerType;
218
+
219
+			$server[$headerType] = $headerValue;
220
+		}
221
+
222
+		return $server;
223
+	}
224 224
 }
Please login to merge, or discard this patch.
src/Modules/Core/ModelObservers/SettingsObserver.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -6,67 +6,67 @@
 block discarded – undo
6 6
 class SettingsObserver
7 7
 {
8 8
 
9
-    public function saving($model)
10
-    {
11
-        //
12
-    }
9
+	public function saving($model)
10
+	{
11
+		//
12
+	}
13 13
 
14
-    public function saved($model)
15
-    {
16
-        //
17
-    }
14
+	public function saved($model)
15
+	{
16
+		//
17
+	}
18 18
 
19
-    /**
20
-     * Prevent the creating of the settings.
21
-     *
22
-     * @param  object $model the model beign created.
23
-     * @return void
24
-     */
25
-    public function creating($model)
26
-    {
27
-        \ErrorHandler::cannotCreateSetting();
28
-    }
19
+	/**
20
+	 * Prevent the creating of the settings.
21
+	 *
22
+	 * @param  object $model the model beign created.
23
+	 * @return void
24
+	 */
25
+	public function creating($model)
26
+	{
27
+		\ErrorHandler::cannotCreateSetting();
28
+	}
29 29
 
30
-    public function created($model)
31
-    {
32
-        //
33
-    }
30
+	public function created($model)
31
+	{
32
+		//
33
+	}
34 34
 
35
-    /**
36
-     * Prevent updating of the setting key.
37
-     *
38
-     * @param  object $model the model beign updated.
39
-     * @return void
40
-     */
41
-    public function updating($model)
42
-    {
43
-        if ($model->getOriginal('key') !== $model->key) {
44
-            \ErrorHandler::cannotUpdateSettingKey();
45
-        }
46
-    }
35
+	/**
36
+	 * Prevent updating of the setting key.
37
+	 *
38
+	 * @param  object $model the model beign updated.
39
+	 * @return void
40
+	 */
41
+	public function updating($model)
42
+	{
43
+		if ($model->getOriginal('key') !== $model->key) {
44
+			\ErrorHandler::cannotUpdateSettingKey();
45
+		}
46
+	}
47 47
 
48
-    public function updated($model)
49
-    {
50
-        //
51
-    }
48
+	public function updated($model)
49
+	{
50
+		//
51
+	}
52 52
 
53
-    public function deleting($model)
54
-    {
55
-        //
56
-    }
53
+	public function deleting($model)
54
+	{
55
+		//
56
+	}
57 57
 
58
-    public function deleted($model)
59
-    {
60
-        //
61
-    }
58
+	public function deleted($model)
59
+	{
60
+		//
61
+	}
62 62
 
63
-    public function restoring($model)
64
-    {
65
-        //
66
-    }
63
+	public function restoring($model)
64
+	{
65
+		//
66
+	}
67 67
 
68
-    public function restored($model)
69
-    {
70
-        //
71
-    }
68
+	public function restored($model)
69
+	{
70
+		//
71
+	}
72 72
 }
Please login to merge, or discard this patch.
src/Modules/Core/Traits/Translatable.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -2,46 +2,46 @@
 block discarded – undo
2 2
 
3 3
 trait Translatable
4 4
 {
5
-    /**
6
-     * Create a new model instance that is existing.
7
-     *
8
-     * @param  array  $attributes
9
-     * @param  string|null  $connection
10
-     * @return static
11
-     */
12
-    public function newFromBuilder($attributes = [], $connection = null)
13
-    {
14
-        $model = parent::newFromBuilder($attributes, $connection);
5
+	/**
6
+	 * Create a new model instance that is existing.
7
+	 *
8
+	 * @param  array  $attributes
9
+	 * @param  string|null  $connection
10
+	 * @return static
11
+	 */
12
+	public function newFromBuilder($attributes = [], $connection = null)
13
+	{
14
+		$model = parent::newFromBuilder($attributes, $connection);
15 15
 
16
-        foreach ($model->attributes as $key => $value) {
17
-            if (isset($this->translatable) && in_array($key, $this->translatable)) {
18
-                $model->$key = $this->getTranslatedAttribute($value);
19
-            }
20
-        }
16
+		foreach ($model->attributes as $key => $value) {
17
+			if (isset($this->translatable) && in_array($key, $this->translatable)) {
18
+				$model->$key = $this->getTranslatedAttribute($value);
19
+			}
20
+		}
21 21
 
22
-        return $model;
23
-    }
22
+		return $model;
23
+	}
24 24
 
25
-    /**
26
-     * Returns a translatable model attribute based on the application's locale settings.
27
-     *
28
-     * @param $values
29
-     * @return string
30
-     */
31
-    protected function getTranslatedAttribute($values)
32
-    {
33
-        $values         = json_decode($values);
34
-        $primaryLocale  = \Session::get('locale');
35
-        $fallbackLocale = 'en';
25
+	/**
26
+	 * Returns a translatable model attribute based on the application's locale settings.
27
+	 *
28
+	 * @param $values
29
+	 * @return string
30
+	 */
31
+	protected function getTranslatedAttribute($values)
32
+	{
33
+		$values         = json_decode($values);
34
+		$primaryLocale  = \Session::get('locale');
35
+		$fallbackLocale = 'en';
36 36
 
37
-        if ($primaryLocale == 'all') {
38
-            return $values;
39
-        }
37
+		if ($primaryLocale == 'all') {
38
+			return $values;
39
+		}
40 40
 
41
-        if (! $primaryLocale || ! is_object($values) || ! property_exists($values, $primaryLocale)) {
42
-            return $values ? isset($values->$fallbackLocale) ? $values->$fallbackLocale : $values : '';
43
-        }
41
+		if (! $primaryLocale || ! is_object($values) || ! property_exists($values, $primaryLocale)) {
42
+			return $values ? isset($values->$fallbackLocale) ? $values->$fallbackLocale : $values : '';
43
+		}
44 44
 
45
-        return $primaryLocale == 'all' ? $values : $values->$primaryLocale;
46
-    }
45
+		return $primaryLocale == 'all' ? $values : $values->$primaryLocale;
46
+	}
47 47
 }
Please login to merge, or discard this patch.
src/Modules/Notifications/Resources/Lang/en/notifications.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@
 block discarded – undo
2 2
 
3 3
 return [
4 4
     
5
-    /**
6
-     * Here goes your notification messages.
7
-     */
5
+	/**
6
+	 * Here goes your notification messages.
7
+	 */
8 8
 
9 9
 ];
Please login to merge, or discard this patch.
files/Handler.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -7,67 +7,67 @@
 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
-     * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
33
-     *
34
-     * @param  \Exception  $exception
35
-     * @return void
36
-     */
37
-    public function report(Exception $exception)
38
-    {
39
-        parent::report($exception);
40
-    }
29
+	/**
30
+	 * Report or log an exception.
31
+	 *
32
+	 * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
33
+	 *
34
+	 * @param  \Exception  $exception
35
+	 * @return void
36
+	 */
37
+	public function report(Exception $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  \Exception  $exception
47
-     * @return \Illuminate\Http\Response
48
-     */
49
-    public function render($request, Exception $exception)
50
-    {
51
-        if ($request->wantsJson()) {
52
-            if ($exception instanceof \Illuminate\Auth\AuthenticationException) {
53
-                \ErrorHandler::unAuthorized();
54
-            }
55
-            if ($exception instanceof \Illuminate\Database\QueryException) {
56
-                \ErrorHandler::dbQueryError();
57
-            } elseif ($exception instanceof \predis\connection\connectionexception) {
58
-                \ErrorHandler::redisNotRunning();
59
-            } elseif ($exception instanceof \GuzzleHttp\Exception\ClientException) {
60
-                \ErrorHandler::connectionError();
61
-            } elseif ($exception instanceof \Symfony\Component\HttpKernel\Exception\HttpException) {
62
-                $errors = $exception->getStatusCode() === 404 ? 'not found' : $exception->getMessage();
63
-                return \Response::json(['errors' => [$errors]], $exception->getStatusCode());
64
-            } elseif ($exception instanceof \Illuminate\Validation\ValidationException) {
65
-                return \Response::json(['errors' => $exception->errors()], 422);
66
-            } elseif (! $exception instanceof \Symfony\Component\ErrorHandler\Error\FatalError) {
67
-                return parent::render($request, $exception);
68
-            }
69
-        }
42
+	/**
43
+	 * Render an exception into an HTTP response.
44
+	 *
45
+	 * @param  \Illuminate\Http\Request  $request
46
+	 * @param  \Exception  $exception
47
+	 * @return \Illuminate\Http\Response
48
+	 */
49
+	public function render($request, Exception $exception)
50
+	{
51
+		if ($request->wantsJson()) {
52
+			if ($exception instanceof \Illuminate\Auth\AuthenticationException) {
53
+				\ErrorHandler::unAuthorized();
54
+			}
55
+			if ($exception instanceof \Illuminate\Database\QueryException) {
56
+				\ErrorHandler::dbQueryError();
57
+			} elseif ($exception instanceof \predis\connection\connectionexception) {
58
+				\ErrorHandler::redisNotRunning();
59
+			} elseif ($exception instanceof \GuzzleHttp\Exception\ClientException) {
60
+				\ErrorHandler::connectionError();
61
+			} elseif ($exception instanceof \Symfony\Component\HttpKernel\Exception\HttpException) {
62
+				$errors = $exception->getStatusCode() === 404 ? 'not found' : $exception->getMessage();
63
+				return \Response::json(['errors' => [$errors]], $exception->getStatusCode());
64
+			} elseif ($exception instanceof \Illuminate\Validation\ValidationException) {
65
+				return \Response::json(['errors' => $exception->errors()], 422);
66
+			} elseif (! $exception instanceof \Symfony\Component\ErrorHandler\Error\FatalError) {
67
+				return parent::render($request, $exception);
68
+			}
69
+		}
70 70
         
71
-        return parent::render($request, $exception);
72
-    }
71
+		return parent::render($request, $exception);
72
+	}
73 73
 }
Please login to merge, or discard this patch.
src/Modules/Core/Setting.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -6,37 +6,37 @@
 block discarded – undo
6 6
 class Setting extends Model
7 7
 {
8 8
 
9
-    use SoftDeletes;
10
-    protected $table    = 'settings';
11
-    protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
12
-    protected $hidden   = ['deleted_at'];
13
-    protected $guarded  = ['id', 'key'];
14
-    protected $fillable = ['name', 'value'];
15
-    public $searchable  = ['name', 'value', 'key'];
9
+	use SoftDeletes;
10
+	protected $table    = 'settings';
11
+	protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
12
+	protected $hidden   = ['deleted_at'];
13
+	protected $guarded  = ['id', 'key'];
14
+	protected $fillable = ['name', 'value'];
15
+	public $searchable  = ['name', 'value', 'key'];
16 16
     
17
-    public function getCreatedAtAttribute($value)
18
-    {
19
-        return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
20
-    }
17
+	public function getCreatedAtAttribute($value)
18
+	{
19
+		return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
20
+	}
21 21
 
22
-    public function getUpdatedAtAttribute($value)
23
-    {
24
-        return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
25
-    }
22
+	public function getUpdatedAtAttribute($value)
23
+	{
24
+		return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
25
+	}
26 26
 
27
-    public function getDeletedAtAttribute($value)
28
-    {
29
-        return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
30
-    }
27
+	public function getDeletedAtAttribute($value)
28
+	{
29
+		return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
30
+	}
31 31
     
32
-    public function newCollection(array $models = [])
33
-    {
34
-        return parent::newCollection($models)->keyBy('key');
35
-    }
32
+	public function newCollection(array $models = [])
33
+	{
34
+		return parent::newCollection($models)->keyBy('key');
35
+	}
36 36
 
37
-    public static function boot()
38
-    {
39
-        parent::boot();
40
-        Setting::observe(\App::make('App\Modules\Core\ModelObservers\SettingsObserver'));
41
-    }
37
+	public static function boot()
38
+	{
39
+		parent::boot();
40
+		Setting::observe(\App::make('App\Modules\Core\ModelObservers\SettingsObserver'));
41
+	}
42 42
 }
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('skeleton.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('skeleton.confrim_email_url').'/'.$notifiable->confirmation_code);
48
+	}
49 49
 }
Please login to merge, or discard this patch.