1 | <?php |
||
12 | class Service |
||
13 | { |
||
14 | /** @var Context */ |
||
15 | protected $context = null; |
||
16 | |||
17 | /** @var string */ |
||
18 | protected $module = null; |
||
19 | |||
20 | /** |
||
21 | * @param Context $context |
||
22 | * @param string $module |
||
23 | * |
||
24 | * @return void |
||
|
|||
25 | */ |
||
26 | public function __construct($context = null, $module = null) |
||
36 | |||
37 | /** |
||
38 | * @param Context $context |
||
39 | * |
||
40 | * @return void |
||
41 | */ |
||
42 | public function setContext($context) |
||
46 | |||
47 | /** |
||
48 | * @param string $module |
||
49 | * |
||
50 | * @return void |
||
51 | */ |
||
52 | public function setModule($module) |
||
56 | |||
57 | /** |
||
58 | * Ensure that a method can be called within this service |
||
59 | * |
||
60 | * @param string $method |
||
61 | * |
||
62 | * @return bool |
||
63 | */ |
||
64 | public function isCallable($method) |
||
68 | |||
69 | /** |
||
70 | * Prepare the calling of a method |
||
71 | * |
||
72 | * @param object $call |
||
73 | * |
||
74 | * @return bool |
||
75 | */ |
||
76 | public function prepareCall($call) |
||
80 | |||
81 | /** |
||
82 | * Attempt to execute a call on this service |
||
83 | * |
||
84 | * @param object $call |
||
85 | * @param mixed $data |
||
86 | * |
||
87 | * @return mixed |
||
88 | */ |
||
89 | public function call($call, $data = null) |
||
97 | |||
98 | /** |
||
99 | * Execute a call |
||
100 | * |
||
101 | * @param object $call |
||
102 | * @param string $method |
||
103 | * @param mixed $data |
||
104 | * |
||
105 | * @return mixed |
||
106 | */ |
||
107 | protected function executeCall($call, $method, $data) |
||
122 | |||
123 | /** |
||
124 | * Assemble injected method parameters |
||
125 | * |
||
126 | * Note: $path and $data are reserved parameters |
||
127 | * |
||
128 | * @param \ReflectionMethod $reflect |
||
129 | * @param string $path |
||
130 | * @param mixed $data |
||
131 | * |
||
132 | * @return array |
||
133 | */ |
||
134 | private function getMethodArgs($reflect, $path, $data) |
||
155 | } |
||
156 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.