1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @author : Jagepard <[email protected]"> |
5
|
|
|
* @license https://mit-license.org/ MIT |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace Rudra\Container\Traits; |
9
|
|
|
|
10
|
|
|
use Rudra\Container\{ |
11
|
|
|
Abstracts\AbstractRequest, Abstracts\AbstractResponse, Abstracts\ContainerInterface, Cookie, Rudra, Session |
12
|
|
|
}; |
13
|
|
|
|
14
|
|
|
trait PublicApplicationTrait |
15
|
|
|
{ |
16
|
|
|
public function setServices(array $services): void |
17
|
|
|
{ |
18
|
|
|
$this->_setServices($services); |
|
|
|
|
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
public function binding(): ContainerInterface |
22
|
|
|
{ |
23
|
|
|
return $this->_binding(); |
|
|
|
|
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
public function services(): ContainerInterface |
27
|
|
|
{ |
28
|
|
|
return $this->_services(); |
|
|
|
|
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function config(): ContainerInterface |
32
|
|
|
{ |
33
|
|
|
return $this->_config(); |
|
|
|
|
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function request(): AbstractRequest |
37
|
|
|
{ |
38
|
|
|
return $this->_request(); |
|
|
|
|
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public function response(): AbstractResponse |
42
|
|
|
{ |
43
|
|
|
return $this->_response(); |
|
|
|
|
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function cookie(): Cookie |
47
|
|
|
{ |
48
|
|
|
return $this->_cookie(); |
|
|
|
|
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function session(): Session |
52
|
|
|
{ |
53
|
|
|
return $this->_session(); |
|
|
|
|
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/* |
57
|
|
|
| Creates an object without adding to the container |
58
|
|
|
*/ |
59
|
|
|
public function new($object, $params = null) |
60
|
|
|
{ |
61
|
|
|
return new $this->_new($object, $params); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function get(string $key = null) |
65
|
|
|
{ |
66
|
|
|
return $this->_get($key); |
|
|
|
|
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function set(array $data): void |
70
|
|
|
{ |
71
|
|
|
$this->_set($data); |
|
|
|
|
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
public function has(string $key): bool |
75
|
|
|
{ |
76
|
|
|
return $this->_has($key); |
|
|
|
|
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
|
80
|
|
|
public function __call($method, $parameters) { |
81
|
|
|
return $this->$method(...$parameters); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
public static function __callStatic($method, $parameters) |
85
|
|
|
{ |
86
|
|
|
return Rudra::run()->$method(...$parameters); |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
|