- Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathDataModel.php
More file actions
45 lines (33 loc) · 884 Bytes
/
DataModel.php
File metadata and controls
45 lines (33 loc) · 884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
* (c) 2018 OpenTHC, Inc.
* This file is part of OpenTHC API released under MIT License
* SPDX-License-Identifier: MIT
*/
namespace OpenTHC\API\Controller;
class DataModel extends \OpenTHC\Controller\Base
{
/**
*
*/
function __invoke($REQ, $RES, $ARG)
{
$file = sprintf('%s/webroot/openapi.yaml', APP_ROOT);
$model_data = yaml_parse_file($file);
$model_list = $model_data['components']['schemas'];
// unset($model_list['Response_General']);
// unset($model_list['Response_Failure']);
$data = [];
$data['page_title'] = 'API / Data Model';
$data['model_list'] = [];
foreach ($model_list as $mk => $mv) {
if (preg_match('/^(Request|Response)/', $mk)) {
continue;
}
$mv['name'] = $mk;
$data['model_list'][$mk] = $mv;
}
// _ksort_r($data['model_list']);
return $RES->write( $this->render('data-model', $data) );
}
}