1 | <?php |
||
2 | /** |
||
3 | * Analytics |
||
4 | * |
||
5 | * SPDX-FileCopyrightText: 2019-2022 Marcel Scherello |
||
6 | * SPDX-License-Identifier: AGPL-3.0-or-later |
||
7 | */ |
||
8 | |||
9 | namespace OCA\Analytics\Controller; |
||
10 | |||
11 | use OCA\Analytics\Service\PanoramaService; |
||
12 | use OCP\AppFramework\Controller; |
||
0 ignored issues
–
show
|
|||
13 | use OCP\AppFramework\Http\DataResponse; |
||
0 ignored issues
–
show
The type
OCP\AppFramework\Http\DataResponse was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
14 | use OCP\DB\Exception; |
||
0 ignored issues
–
show
The type
OCP\DB\Exception was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
15 | use OCP\IRequest; |
||
0 ignored issues
–
show
The type
OCP\IRequest was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
16 | use OCP\PreConditionNotMetException; |
||
0 ignored issues
–
show
The type
OCP\PreConditionNotMetException was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
17 | use Psr\Log\LoggerInterface; |
||
0 ignored issues
–
show
The type
Psr\Log\LoggerInterface was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
18 | |||
19 | class PanoramaController extends Controller |
||
20 | { |
||
21 | private $logger; |
||
22 | private $PanoramaService; |
||
23 | |||
24 | public function __construct( |
||
25 | $appName, |
||
26 | IRequest $request, |
||
27 | LoggerInterface $logger, |
||
28 | PanoramaService $PanoramaService |
||
29 | ) |
||
30 | { |
||
31 | parent::__construct($appName, $request); |
||
32 | $this->logger = $logger; |
||
33 | $this->PanoramaService = $PanoramaService; |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * get all reports |
||
38 | * |
||
39 | * @NoAdminRequired |
||
40 | * @return DataResponse |
||
41 | * @throws Exception |
||
42 | * @throws PreConditionNotMetException |
||
43 | */ |
||
44 | public function index() |
||
45 | { |
||
46 | return new DataResponse($this->PanoramaService->index()); |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * create new blank report |
||
51 | * |
||
52 | * @NoAdminRequired |
||
53 | * @param int $type |
||
54 | * @param int $parent |
||
55 | * @return DataResponse |
||
56 | * @throws Exception |
||
57 | */ |
||
58 | public function create(int $type, int $parent) |
||
59 | { |
||
60 | return new DataResponse($this->PanoramaService->create($type, $parent)); |
||
61 | } |
||
62 | |||
63 | |||
64 | /** |
||
65 | * get own report details |
||
66 | * |
||
67 | * @NoAdminRequired |
||
68 | * @param int $panoramaId |
||
69 | * @return DataResponse |
||
70 | */ |
||
71 | public function read(int $panoramaId) |
||
72 | { |
||
73 | return new DataResponse($this->PanoramaService->read($panoramaId)); |
||
74 | } |
||
75 | |||
76 | /** |
||
77 | * Delete report and all depending objects |
||
78 | * |
||
79 | * @NoAdminRequired |
||
80 | * @param int $panoramaId |
||
81 | * @return DataResponse |
||
82 | */ |
||
83 | public function delete(int $panoramaId) |
||
84 | { |
||
85 | if ($this->PanoramaService->isOwn($panoramaId)) { |
||
86 | return new DataResponse($this->PanoramaService->delete($panoramaId)); |
||
87 | } else { |
||
88 | return new DataResponse(false,400); |
||
89 | } |
||
90 | } |
||
91 | |||
92 | /** |
||
93 | * get report details |
||
94 | * |
||
95 | * @NoAdminRequired |
||
96 | * @param int $panoramaId |
||
97 | * @param $name |
||
98 | * @param int $type |
||
99 | * @param int $parent |
||
100 | * @param $pages |
||
101 | * @return DataResponse |
||
102 | * @throws Exception |
||
103 | */ |
||
104 | public function update(int $panoramaId, $name, int $type, int $parent, $pages) |
||
105 | { |
||
106 | $pages = json_encode($pages); |
||
107 | return new DataResponse($this->PanoramaService->update($panoramaId, $name, $type, $parent, $pages)); |
||
108 | } |
||
109 | |||
110 | /** |
||
111 | * get own reports which are marked as favorites |
||
112 | * |
||
113 | * @NoAdminRequired |
||
114 | * @return DataResponse |
||
115 | * @throws Exception |
||
116 | */ |
||
117 | public function getOwnFavoriteReports() |
||
118 | { |
||
119 | return new DataResponse($this->PanoramaService->getOwnFavoriteReports()); |
||
120 | } |
||
121 | |||
122 | /** |
||
123 | * set/remove the favorite flag for a report |
||
124 | * |
||
125 | * @NoAdminRequired |
||
126 | * @param int $panoramaId |
||
127 | * @param string $favorite |
||
128 | * @return DataResponse |
||
129 | */ |
||
130 | public function setFavorite(int $panoramaId, string $favorite) |
||
131 | { |
||
132 | return new DataResponse($this->PanoramaService->setFavorite($panoramaId, $favorite)); |
||
133 | } |
||
134 | |||
135 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths