1 | <?php |
||
12 | class ControllerEndpointType extends EndpointType |
||
13 | { |
||
14 | /** @var string */ |
||
15 | protected $controller; |
||
16 | |||
17 | /** @var array */ |
||
18 | protected $defaultParameters; |
||
19 | |||
20 | /** @var array */ |
||
21 | protected static $cachedRoutes = []; |
||
22 | |||
23 | public function __construct(string $controller, array $defaultParameters = null) |
||
28 | |||
29 | public function getEndpoints(Model $model = null): array |
||
42 | |||
43 | public function getCollectionEndpoints(): array |
||
44 | { |
||
45 | $controller = new $this->controller(); |
||
46 | |||
47 | $endpoints = property_exists($controller, 'globalEndPointMethods') |
||
48 | ? $controller->globalEndPointMethods |
||
49 | : ['index', 'store', 'create']; |
||
50 | |||
51 | return $this->resolveEndpoints($endpoints); |
||
52 | } |
||
53 | |||
54 | protected function resolveEndpoints(array $methodsToInclude, Model $model = null) : array |
||
65 | |||
66 | protected static function getRoutesForController(string $controller): Collection |
||
81 | } |
||
82 |