Passed
Push — 0.7.0 ( 9dbaae...ecb047 )
by Alexander
03:27 queued 11s
created
src/components/Core/Http/Lenevor.php 1 patch
Indentation   +172 added lines, -172 removed lines patch added patch discarded remove patch
@@ -39,180 +39,180 @@
 block discarded – undo
39 39
  */
40 40
 class Lenevor implements LenevorContract
41 41
 {
42
-	/**
43
-	 * The application implementation.
44
-	 * 
45
-	 * @var \Syscodes\Contracts\Core\Application $app
46
-	 */
47
-	protected $app;
42
+    /**
43
+     * The application implementation.
44
+     * 
45
+     * @var \Syscodes\Contracts\Core\Application $app
46
+     */
47
+    protected $app;
48 48
 	
49
-	/**
50
-	 * The bootstrap classes for the application.
51
-	 * 
52
-	 * @var array $bootstrappers
53
-	 */
54
-	protected $bootstrappers = [
55
-		\Syscodes\Core\Bootstrap\BootDetectEnvironment::class,
56
-		\Syscodes\Core\Bootstrap\BootConfiguration::class,
57
-		\Syscodes\Core\Bootstrap\BootHandleExceptions::class,
58
-		\Syscodes\Core\Bootstrap\BootRegisterFacades::class,
59
-		\Syscodes\Core\Bootstrap\BootRegisterProviders::class,
60
-		\Syscodes\Core\Bootstrap\BootProviders::class,
61
-	];
49
+    /**
50
+     * The bootstrap classes for the application.
51
+     * 
52
+     * @var array $bootstrappers
53
+     */
54
+    protected $bootstrappers = [
55
+        \Syscodes\Core\Bootstrap\BootDetectEnvironment::class,
56
+        \Syscodes\Core\Bootstrap\BootConfiguration::class,
57
+        \Syscodes\Core\Bootstrap\BootHandleExceptions::class,
58
+        \Syscodes\Core\Bootstrap\BootRegisterFacades::class,
59
+        \Syscodes\Core\Bootstrap\BootRegisterProviders::class,
60
+        \Syscodes\Core\Bootstrap\BootProviders::class,
61
+    ];
62 62
 	
63
-	/**
64
-	 * Activate the console mode.
65
-	 * 
66
-	 * @var bool $isCli
67
-	 */
68
-	protected $isCli = false;
69
-
70
-	/**
71
-	 * Get the application's middleware.
72
-	 * 
73
-	 * @var array $middleware
74
-	 */
75
-	protected $middleware = [];
76
-
77
-	/**
78
-	 * The router instance.
79
-	 * 
80
-	 * @var \Syscodes\Routing\Router $router
81
-	 */
82
-	protected $router;
83
-
84
-	/**
85
-	 * Total app execution time.
86
-	 * 
87
-	 * @var float $totalTime
88
-	 */
89
-	protected $totalTime;
90
-
91
-	/**
92
-	 * Constructor. Lenevor class instance.
93
-	 * 
94
-	 * @param  \Syscodes\Contracts\Core\Application  $app
95
-	 * @param  \Syscodes\Routing\Router  $router
96
-	 * 
97
-	 * @return void
98
-	 */
99
-	public function __construct(Application $app, Router $router)
100
-	{
101
-		$this->app    = $app;
102
-		$this->router = $router;
103
-	}
63
+    /**
64
+     * Activate the console mode.
65
+     * 
66
+     * @var bool $isCli
67
+     */
68
+    protected $isCli = false;
69
+
70
+    /**
71
+     * Get the application's middleware.
72
+     * 
73
+     * @var array $middleware
74
+     */
75
+    protected $middleware = [];
76
+
77
+    /**
78
+     * The router instance.
79
+     * 
80
+     * @var \Syscodes\Routing\Router $router
81
+     */
82
+    protected $router;
83
+
84
+    /**
85
+     * Total app execution time.
86
+     * 
87
+     * @var float $totalTime
88
+     */
89
+    protected $totalTime;
90
+
91
+    /**
92
+     * Constructor. Lenevor class instance.
93
+     * 
94
+     * @param  \Syscodes\Contracts\Core\Application  $app
95
+     * @param  \Syscodes\Routing\Router  $router
96
+     * 
97
+     * @return void
98
+     */
99
+    public function __construct(Application $app, Router $router)
100
+    {
101
+        $this->app    = $app;
102
+        $this->router = $router;
103
+    }
104 104
 	
105
-	/** 
106
-	 * Initialize CLI command.
107
-	 * 
108
-	 * @return bool
109
-	 */
110
-	public function initCli()
111
-	{
112
-		return $this->isCli = (new Http)->isCli();
113
-	}
105
+    /** 
106
+     * Initialize CLI command.
107
+     * 
108
+     * @return bool
109
+     */
110
+    public function initCli()
111
+    {
112
+        return $this->isCli = (new Http)->isCli();
113
+    }
114 114
 	 
115
-	/**
116
-	 * Initializes the framework, this can only be called once.
117
-	 * Launch the application.
118
-	 * 
119
-	 * @param  \Syscodes\http\Request  $request
120
-	 *
121
-	 * @return \Syscodes\Http\Response
122
-	 */
123
-	public function handle($request)
124
-	{
125
-		try {
126
-			$response = $this->sendRequestThroughRouter($request);
127
-		} catch (Throwable $e) {
128
-			$this->reportException($e);
129
-
130
-			$response = $this->renderException($request, $e);
131
-		}		
132
-
133
-		return $response;
134
-	}
135
-
136
-	/**
137
-	 * Send the given request through the router.
138
-	 * 
139
-	 * @param  \Syscodes\Http\Request  $request
140
-	 * 
141
-	 * @return \Syscodes\Http\Response
142
-	 */
143
-	protected function sendRequestThroughRouter($request)
144
-	{
145
-		$this->app->instance('request', $request);  
146
-
147
-		Facade::clearResolvedInstance('request');
148
-
149
-		// Load configuration system
150
-		$this->bootstrap();
151
-
152
-		return (new Pipeline($this->app))
153
-				->send($request)
154
-				->through($this->app->skipGoingMiddleware() ? [] : $this->middleware)
155
-				->then($this->dispatchToRouter());
156
-	}
157
-
158
-	/**
159
-	 * Bootstrap the application for HTTP requests.
160
-	 * 
161
-	 * @return void
162
-	 */
163
-	protected function bootstrap()
164
-	{		
165
-		if ( ! $this->app->hasBeenBootstrapped()) {
166
-			$this->app->bootstrapWith($this->bootstrappers());
167
-		}
168
-	}
169
-
170
-	/**
171
-	 * Get the bootstrap classes for the application.
172
-	 * 
173
-	 * @return array
174
-	 */
175
-	protected function bootstrappers()
176
-	{
177
-		return $this->bootstrappers;
178
-	}
179
-
180
-	/**
181
-	 * Get the dispatcher of routes.
182
-	 * 	  
183
-	 * @return \Closure
184
- 	 */
185
-	protected function dispatchToRouter()
186
-	{
187
-		return function ($request) {
188
-			$this->app->instance('request', $request);
189
-
190
-			return $this->router->dispatch($request);
191
-		};
192
-	}
193
-
194
-	/**
195
-	 * Report the exception to the exception handler.
196
-	 * 
197
-	 * @param  \Throwable  $e
198
-	 * 
199
-	 * @return void
200
-	 */
201
-	protected function reportException(Throwable $e)
202
-	{
203
-		return $this->app[ExceptionHandler::class]->report($e);
204
-	}
115
+    /**
116
+     * Initializes the framework, this can only be called once.
117
+     * Launch the application.
118
+     * 
119
+     * @param  \Syscodes\http\Request  $request
120
+     *
121
+     * @return \Syscodes\Http\Response
122
+     */
123
+    public function handle($request)
124
+    {
125
+        try {
126
+            $response = $this->sendRequestThroughRouter($request);
127
+        } catch (Throwable $e) {
128
+            $this->reportException($e);
129
+
130
+            $response = $this->renderException($request, $e);
131
+        }		
132
+
133
+        return $response;
134
+    }
135
+
136
+    /**
137
+     * Send the given request through the router.
138
+     * 
139
+     * @param  \Syscodes\Http\Request  $request
140
+     * 
141
+     * @return \Syscodes\Http\Response
142
+     */
143
+    protected function sendRequestThroughRouter($request)
144
+    {
145
+        $this->app->instance('request', $request);  
146
+
147
+        Facade::clearResolvedInstance('request');
148
+
149
+        // Load configuration system
150
+        $this->bootstrap();
151
+
152
+        return (new Pipeline($this->app))
153
+                ->send($request)
154
+                ->through($this->app->skipGoingMiddleware() ? [] : $this->middleware)
155
+                ->then($this->dispatchToRouter());
156
+    }
157
+
158
+    /**
159
+     * Bootstrap the application for HTTP requests.
160
+     * 
161
+     * @return void
162
+     */
163
+    protected function bootstrap()
164
+    {		
165
+        if ( ! $this->app->hasBeenBootstrapped()) {
166
+            $this->app->bootstrapWith($this->bootstrappers());
167
+        }
168
+    }
169
+
170
+    /**
171
+     * Get the bootstrap classes for the application.
172
+     * 
173
+     * @return array
174
+     */
175
+    protected function bootstrappers()
176
+    {
177
+        return $this->bootstrappers;
178
+    }
179
+
180
+    /**
181
+     * Get the dispatcher of routes.
182
+     * 	  
183
+     * @return \Closure
184
+     */
185
+    protected function dispatchToRouter()
186
+    {
187
+        return function ($request) {
188
+            $this->app->instance('request', $request);
189
+
190
+            return $this->router->dispatch($request);
191
+        };
192
+    }
193
+
194
+    /**
195
+     * Report the exception to the exception handler.
196
+     * 
197
+     * @param  \Throwable  $e
198
+     * 
199
+     * @return void
200
+     */
201
+    protected function reportException(Throwable $e)
202
+    {
203
+        return $this->app[ExceptionHandler::class]->report($e);
204
+    }
205 205
 	
206
-	/**
207
-	 * Render the exception to a response.
208
-	 * 
209
-	 * @param  \Syscodes\Http\Request  $request
210
-	 * @param  \Throwable  $e
211
-	 * 
212
-	 * @return \Syscodes\Http\Response
213
-	 */
214
-	protected function renderException($request, Throwable $e)
215
-	{
216
-		return $this->app[ExceptionHandler::class]->render($request, $e);
217
-	}
218
- }
219 206
\ No newline at end of file
207
+    /**
208
+     * Render the exception to a response.
209
+     * 
210
+     * @param  \Syscodes\Http\Request  $request
211
+     * @param  \Throwable  $e
212
+     * 
213
+     * @return \Syscodes\Http\Response
214
+     */
215
+    protected function renderException($request, Throwable $e)
216
+    {
217
+        return $this->app[ExceptionHandler::class]->render($request, $e);
218
+    }
219
+    }
220 220
\ No newline at end of file
Please login to merge, or discard this patch.