|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Bone\App\Controller; |
|
4
|
|
|
|
|
5
|
|
|
use Bone\Controller\Controller; |
|
6
|
|
|
use Bone\Http\Response\HtmlResponse; |
|
7
|
|
|
use Psr\Http\Message\ResponseInterface; |
|
8
|
|
|
use Psr\Http\Message\ServerRequestInterface; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Class IndexController |
|
12
|
|
|
* If you need to create a constructor, edit the package class to set it up automatically via dependency injection |
|
13
|
|
|
* |
|
14
|
|
|
* The below annotations are for use with delboy1978uk/bone-open-api, you can remove them if you wont be using it |
|
15
|
|
|
* @OA\Info( |
|
16
|
|
|
* version="1.0.0", |
|
17
|
|
|
* title="Bone Framework API", |
|
18
|
|
|
* description="This be a swashbucklin' API." |
|
19
|
|
|
* ) |
|
20
|
|
|
* @OA\ExternalDocumentation( |
|
21
|
|
|
* description="By delboy1978uk", |
|
22
|
|
|
* url="https://github.com/delboy1978uk/boneframework" |
|
23
|
|
|
* ) |
|
24
|
|
|
* @OA\SecurityScheme( |
|
25
|
|
|
* type="oauth2", |
|
26
|
|
|
* name="bone-oauth2", |
|
27
|
|
|
* securityScheme="bone-oauth2", |
|
28
|
|
|
* @OA\Flow( |
|
29
|
|
|
* flow="authorizationCode", |
|
30
|
|
|
* authorizationUrl="https://awesome.scot/oauth2/authorize", |
|
31
|
|
|
* scopes={ |
|
32
|
|
|
* "basic": "Access public API data", |
|
33
|
|
|
* "register-client": "Create and rewgistger clients", |
|
34
|
|
|
* } |
|
35
|
|
|
* ) |
|
36
|
|
|
* ) |
|
37
|
|
|
* @OA\SecurityScheme( |
|
38
|
|
|
* type="apiKey", |
|
39
|
|
|
* in="header", |
|
40
|
|
|
* securityScheme="api_key", |
|
41
|
|
|
* name="api_key" |
|
42
|
|
|
* ) |
|
43
|
|
|
*/ |
|
44
|
|
|
class IndexController extends Controller |
|
45
|
|
|
{ |
|
46
|
|
|
/** |
|
47
|
|
|
* @param ServerRequestInterface $request |
|
48
|
|
|
* @param array $args |
|
49
|
|
|
* @return ResponseInterface |
|
50
|
|
|
*/ |
|
51
|
1 |
|
public function index(ServerRequestInterface $request) : ResponseInterface |
|
|
|
|
|
|
52
|
|
|
{ |
|
53
|
1 |
|
$body = $this->view->render('app::index'); |
|
54
|
|
|
|
|
55
|
1 |
|
return new HtmlResponse($body); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* @param ServerRequestInterface $request |
|
60
|
|
|
* @param array $args |
|
61
|
|
|
* @return ResponseInterface |
|
62
|
|
|
*/ |
|
63
|
1 |
|
public function learn(ServerRequestInterface $request) : ResponseInterface |
|
|
|
|
|
|
64
|
|
|
{ |
|
65
|
1 |
|
$body = $this->view->render('app::learn'); |
|
66
|
|
|
|
|
67
|
1 |
|
return new HtmlResponse($body); |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.