-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMiddleware.php
More file actions
48 lines (44 loc) · 1.22 KB
/
Middleware.php
File metadata and controls
48 lines (44 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* @package framework
* @copyright Copyright (c) 2005-2020 The Regents of the University of California.
* @license http://opensource.org/licenses/MIT MIT
*/
namespace Qubeshub\Base;
use Qubeshub\Base\ServiceProvider;
use Hubzero\Http\Request;
/**
* App Middleware
*
* Inspired, in part, by Laravel
* http://laravel.com
*/
abstract class Middleware extends ServiceProvider
{
/**
* Call next service
*
* This under the hood resolves the stack on the api container
* and then calls next on it passing the request object. The stack
* object holds onto the current position it is within the stack so
* each service doesnt have to know anything about what comes before
* or after it.
*
* @param object $request Request object
* @return mixed Result of next runnable service
*/
public function next(Request $request)
{
return $this->app['stack']->next($request);
}
/**
* Handle request object
*
* Each runnable service must implement this method and do what it wants
* and then MUST pass the request along to the next service after its done.
*
* @param object $request Request object
* @return mixed Result
*/
abstract public function handle(Request $request);
}