Skip to content

Commit

Permalink
Add feedback from sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
mattamon committed May 22, 2024
1 parent d6cf393 commit 3adb75d
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/Note/Controller/Element/CollectionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ public function getNotes(
$collection->getTotalItems()
);
}
}
}
3 changes: 2 additions & 1 deletion src/Note/Controller/Element/CreateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ public function __construct(
public function createNote(
string $elementType,
int $id,
#[MapRequestPayload] CreateNote $createNote): JsonResponse
#[MapRequestPayload] CreateNote $createNote
): JsonResponse
{
$note = $this->noteService->createNote(new NoteElement($elementType, $id), $createNote);
return $this->jsonResponse(['id' => $note->getId()]);
Expand Down
6 changes: 3 additions & 3 deletions src/Note/Extractor/NoteDataExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ public function extractCPath(CoreNote $note) : string
public function extractUserData(CoreNote $note) : NoteUser
{
$emptyUser = new NoteUser();
if(!$note->getUser()) {
if (!$note->getUser()) {
return $emptyUser;
}

$user = $this->userResolver->getById($note->getUser());

if(!$user) {
if (!$user) {
return $emptyUser;
}

Expand Down Expand Up @@ -101,4 +101,4 @@ private function extractElementData(ElementInterface $element): array
'type' => $element->getType(),
];
}
}
}
2 changes: 1 addition & 1 deletion src/Note/Hydrator/NoteHydrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ public function hydrate(CoreNote $note): Note
$noteUser->getName(),
);
}
}
}
2 changes: 1 addition & 1 deletion src/Note/Repository/NoteRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function listNotes(NoteElement $noteElement, NoteParameters $parameters):
public function deleteNote(int $id): void
{
$note = $this->noteResolver->getById($id);
if(!$note) {
if (!$note) {
throw new ElementNotFoundException($id, 'Note');
}
$note->delete();
Expand Down
2 changes: 1 addition & 1 deletion src/Note/Request/NoteElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ public function getId(): int
{
return $this->id;
}
}
}
2 changes: 1 addition & 1 deletion src/Note/Schema/CreateNote.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ public function getType(): string
{
return $this->type;
}
}
}
2 changes: 1 addition & 1 deletion src/Note/Schema/Note.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,4 @@ public function getUserName(): ?string
{
return $this->userName;
}
}
}
2 changes: 1 addition & 1 deletion src/Note/Schema/NoteUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ public function getName(): ?string
{
return $this->name;
}
}
}

0 comments on commit 3adb75d

Please sign in to comment.