1 | <?php |
||
10 | abstract class BaseHandler implements ApiHandlerInterface |
||
11 | { |
||
12 | /** |
||
13 | * @var Manager |
||
14 | */ |
||
15 | private $fractal; |
||
16 | |||
17 | /** |
||
18 | * @var EndpointInterface |
||
19 | */ |
||
20 | private $endpoint; |
||
21 | |||
22 | /** |
||
23 | * @var LinkGenerator |
||
24 | */ |
||
25 | protected $linkGenerator; |
||
26 | |||
27 | 45 | public function __construct() |
|
31 | |||
32 | /** |
||
33 | * {@inheritdoc} |
||
34 | */ |
||
35 | public function description() |
||
39 | |||
40 | /** |
||
41 | * {@inheritdoc} |
||
42 | */ |
||
43 | 9 | public function params() |
|
47 | |||
48 | /** |
||
49 | * {@inheritdoc} |
||
50 | */ |
||
51 | public function tags() |
||
55 | |||
56 | protected function getFractal() |
||
63 | |||
64 | /** |
||
65 | * {@inheritdoc} |
||
66 | */ |
||
67 | 24 | public function setEndpointIdentifier(EndpointInterface $endpoint) |
|
71 | |||
72 | /** |
||
73 | * @return EndpointInterface |
||
74 | */ |
||
75 | 9 | public function getEndpoint() |
|
79 | |||
80 | /** |
||
81 | * Set link generator to handler |
||
82 | * |
||
83 | * @param LinkGenerator $linkGenerator |
||
84 | * |
||
85 | * @return $this |
||
86 | */ |
||
87 | 6 | public function setupLinkGenerator(LinkGenerator $linkGenerator) |
|
92 | |||
93 | /** |
||
94 | * Create link to actual handler endpoint |
||
95 | * |
||
96 | * @param array $params |
||
97 | * |
||
98 | * @return string |
||
99 | * @throws \Nette\Application\UI\InvalidLinkException it handler doesn't have linkgenerator or endpoint |
||
100 | */ |
||
101 | 9 | public function createLink($params) |
|
116 | |||
117 | /** |
||
118 | * {@inheritdoc} |
||
119 | */ |
||
120 | abstract public function handle($params); |
||
121 | } |
||
122 |