diff --git a/lib/Controller/NoteApiController.php b/lib/Controller/NoteApiController.php index e4badb3..2d6dd02 100644 --- a/lib/Controller/NoteApiController.php +++ b/lib/Controller/NoteApiController.php @@ -37,7 +37,7 @@ class NoteApiController extends ApiController { private $userId; public function __construct($AppName, - IRequest $request, + IRequest $request, NoteService $noteService, $userId) { @@ -74,7 +74,7 @@ class NoteApiController extends ApiController { * * @param int $id */ - public function show($id): JSONResponse { + public function show(int $id): JSONResponse { $note = $this->noteService->get($this->userId, $id); if (is_null($note)) { return new JSONResponse([], Http::STATUS_NOT_FOUND); @@ -97,7 +97,7 @@ class NoteApiController extends ApiController { * @param string $content * @param string $color */ - public function create($title, $content, $color = "#F7EB96") { + public function create(string $title, string $content, string $color = null) { $note = $this->noteService->create($this->userId, $title, $content, $color); $etag = md5(json_encode($note)); diff --git a/lib/Controller/NoteController.php b/lib/Controller/NoteController.php index 00dc8ab..9aa5883 100644 --- a/lib/Controller/NoteController.php +++ b/lib/Controller/NoteController.php @@ -37,7 +37,7 @@ class NoteController extends Controller { private $userId; public function __construct($AppName, - IRequest $request, + IRequest $request, NoteService $noteService, $userId) { @@ -70,7 +70,7 @@ class NoteController extends Controller { * * @param int $id */ - public function show($id): JSONResponse { + public function show(int $id): JSONResponse { $note = $this->noteService->get($this->userId, $id); if (is_null($note)) { return new JSONResponse([], Http::STATUS_NOT_FOUND); @@ -91,7 +91,7 @@ class NoteController extends Controller { * @param string $content * @param string $color */ - public function create($title, $content, $color = NULL) { + public function create(string $title, string $content, string $color = null) { $note = $this->noteService->create($this->userId, $title, $content, $color); $etag = md5(json_encode($note)); @@ -137,4 +137,5 @@ class NoteController extends Controller { $this->noteService->destroy($this->userId, $id); return new JSONResponse([]); } + }