1 | <?php |
||
52 | class ServerFacade |
||
53 | { |
||
54 | /** |
||
55 | * Server instance |
||
56 | * |
||
57 | * @var \Apparat\Server\Domain\Model\Server |
||
58 | */ |
||
59 | protected static $server = null; |
||
60 | |||
61 | /** |
||
62 | * Register the default routes for a particular repository |
||
63 | * |
||
64 | * @param string $repositoryPath Repository path |
||
65 | * @param int $enable Enable / disable default routes |
||
66 | * @api |
||
67 | */ |
||
68 | 1 | public static function enableObjectRoute($repositoryPath = '', $enable = ObjectRoute::ALL) |
|
72 | |||
73 | /** |
||
74 | * Create and return the server instance |
||
75 | * |
||
76 | * @return Server Server instance |
||
77 | */ |
||
78 | 71 | protected static function getServer() |
|
85 | |||
86 | /** |
||
87 | * Register a route |
||
88 | * |
||
89 | * @param RouteInterface $route |
||
90 | * @api |
||
91 | */ |
||
92 | 2 | public static function registerRoute(RouteInterface $route) |
|
96 | |||
97 | /** |
||
98 | * Dispatch a request |
||
99 | * |
||
100 | * @param ServerRequestInterface $request |
||
101 | * @return ResponseInterface $response |
||
102 | * @api |
||
103 | */ |
||
104 | 3 | public static function dispatchRequest(ServerRequestInterface $request) |
|
115 | |||
116 | /** |
||
117 | * Set the view resources |
||
118 | * |
||
119 | * @param array $viewResources View resources |
||
120 | */ |
||
121 | 1 | public static function setViewResources(array $viewResources) |
|
122 | { |
||
123 | 1 | self::getServer()->setViewResources($viewResources); |
|
124 | 1 | } |
|
125 | |||
126 | /** |
||
127 | * Return view resources |
||
128 | * |
||
129 | * @param string|null $name Optional: view resource name |
||
130 | * @return array View resources |
||
131 | */ |
||
132 | 70 | public static function getViewResources($name = null) |
|
136 | } |
||
137 |