1: <?php
2:
3: namespace Deimos\Controller\Traits;
4:
5: use Deimos\Controller\Exceptions\RequestNotFound;
6: use Deimos\Helper\Traits\Helper;
7: use Deimos\Request\Request as DeimosRequest;
8:
9: trait Request
10: {
11:
12: use Helper;
13:
14: 15: 16:
17: private $request;
18:
19: 20: 21: 22: 23:
24: private function instanceRequest()
25: {
26: if (method_exists($this->builder, 'request'))
27: {
28: return $this->builder->request();
29: }
30:
31: throw new RequestNotFound('Request not found');
32: }
33:
34: 35: 36: 37: 38:
39: protected final function request()
40: {
41: if (!$this->request)
42: {
43: $this->request = $this->instanceRequest();
44: }
45:
46: return $this->request;
47: }
48:
49: }