1 | <?php |
||
21 | class FavoriteController extends ApiController { |
||
22 | |||
23 | private $userId; |
||
24 | private $favoriteMapper; |
||
25 | |||
26 | public function __construct($appName, IRequest $request, FavoriteMapper $favoriteMapper, $userId) { |
||
31 | |||
32 | /** |
||
33 | * @NoAdminRequired |
||
34 | * |
||
35 | * @param $lat int |
||
36 | * @param $lng int |
||
37 | * @param $timestamp string |
||
38 | * @param $name string |
||
39 | * @param $userId int |
||
40 | * @param $id int |
||
41 | * @return JSONResponse |
||
42 | */ |
||
43 | public function update($lat, $lng, $timestamp, $name, $userId, $id) { |
||
44 | |||
45 | $favorite = new Favorite(); |
||
46 | $favorite->setLat($lat); |
||
47 | $favorite->setLng($lng); |
||
48 | if((string)(float)$timestamp === $timestamp) { |
||
49 | if(strtotime(date('d-m-Y H:i:s',$timestamp)) === (int)$timestamp) { |
||
50 | $favorite->setTimestamp((int)$timestamp); |
||
51 | } elseif(strtotime(date('d-m-Y H:i:s',$timestamp/1000)) === (int)floor($timestamp/1000)) { |
||
52 | $favorite->setTimestamp((int)floor($timestamp/1000)); |
||
53 | } |
||
54 | } else { |
||
55 | $favorite->timestamp = strtotime($timestamp); |
||
56 | } |
||
57 | $favorite->setName($name); |
||
58 | $favorite->setUserId($userId); |
||
59 | $favorite->setId($id); |
||
60 | |||
61 | /* Only save favorite if it exists in db */ |
||
62 | try { |
||
63 | $this->favoriteMapper->find($id); |
||
64 | return new JSONResponse($this->favoriteMapper->insert($favorite)); |
||
65 | } catch(\OCP\AppFramework\Db\DoesNotExistException $e) { |
||
|
|||
66 | return new JSONResponse([ |
||
67 | 'error' => $e->getMessage() |
||
68 | ]); |
||
69 | } |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * @NoAdminRequired |
||
74 | * |
||
75 | * @param $lat float |
||
76 | * @param $lng float |
||
77 | * @return JSONResponse |
||
78 | */ |
||
79 | public function addFavorite($lat, $lng){ |
||
93 | |||
94 | /** |
||
95 | * @NoAdminRequired |
||
96 | * |
||
97 | * @return JSONResponse |
||
98 | */ |
||
99 | public function getFavorites(){ |
||
103 | |||
104 | /** |
||
105 | * @NoAdminRequired |
||
106 | * |
||
107 | * @param $id int |
||
108 | * @return JSONResponse |
||
109 | */ |
||
110 | public function removeFavorite($id){ |
||
117 | |||
118 | } |
||
119 |
Scrutinizer analyzes your
composer.json
/composer.lock
file if available to determine the classes, and functions that are defined by your dependencies.It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.