| Total Complexity | 5 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 9 | class RevisionAPI |
||
| 10 | { |
||
| 11 | public function listAPI(string $tableName, int $recordId, int $page = 1, int $perPage = 5) |
||
| 12 | { |
||
| 13 | $dataSource = $this->getListData($tableName, $recordId, $page, $perPage); |
||
| 14 | |||
| 15 | if (empty($dataSource)) { |
||
| 16 | return [ |
||
| 17 | 'success' => false, |
||
| 18 | 'message' => __('record is empty'), |
||
| 19 | 'data' => [] |
||
| 20 | ]; |
||
| 21 | } |
||
| 22 | |||
| 23 | return [ |
||
| 24 | 'success' => true, |
||
| 25 | 'message' => '', |
||
| 26 | 'data' => [ |
||
| 27 | 'dataSource' => $dataSource, |
||
| 28 | ] |
||
| 29 | ]; |
||
| 30 | } |
||
| 31 | |||
| 32 | private function getListData(string $tableName, int $recordId, int $page, int $perPage) |
||
| 49 | } |
||
| 50 | } |
||
| 51 |