Completed
Branch FET/11183/improvements-to-pue-... (232f50)
by
unknown
43:46 queued 26:36
created

RequestStack   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 58
rs 10
wmc 3
lcom 1
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A handleRequest() 0 6 1
A handleResponse() 0 4 1
1
<?php
2
3
namespace EventEspresso\core\services\request;
4
5
defined('EVENT_ESPRESSO_VERSION') || exit;
6
7
8
9
/**
10
 * Class RequestStack
11
 * Basically a container class for holding
12
 * EventEspresso\core\services\request\middleware\Middleware classes
13
 * as well as the core application
14
 *
15
 * @package EventEspresso\core\services\request
16
 * @author  Brent Christensen
17
 * @since   4.9.53
18
 */
19
class RequestStack
20
{
21
22
    /**
23
     * @var RequestDecoratorInterface $request_stack_app
24
     */
25
    protected $request_stack_app;
26
27
    /**
28
     * @var RequestStackCoreAppInterface $core_app
29
     */
30
    protected $core_app;
31
32
    /**
33
     * @var RequestInterface $request
34
     */
35
    protected $request;
36
37
    /**
38
     * @var ResponseInterface $response
39
     */
40
    protected $response;
41
42
43
    /**
44
     * @param RequestDecoratorInterface    $request_stack_app
45
     * @param RequestStackCoreAppInterface $core_app
46
     */
47
    public function __construct(RequestDecoratorInterface $request_stack_app, RequestStackCoreAppInterface $core_app)
48
    {
49
        $this->request_stack_app = $request_stack_app;
50
        $this->core_app      = $core_app;
51
    }
52
53
54
    /**
55
     * @param RequestInterface  $request
56
     * @param ResponseInterface $response
57
     * @return ResponseInterface
58
     */
59
    public function handleRequest(RequestInterface $request, ResponseInterface $response)
60
    {
61
        $this->request  = $request;
62
        $this->response = $response;
63
        return $this->request_stack_app->handleRequest($request, $response);
64
    }
65
66
67
    /**
68
     * handle_response
69
     * executes the handle_response() method on the RequestStackCoreAppInterface object
70
     * after the request stack has been fully processed
71
     */
72
    public function handleResponse()
73
    {
74
        $this->core_app->handleResponse($this->request, $this->response);
75
    }
76
}
77
// Location: RequestStack.php
78