Skip to content

Commit ef26426

Browse files
committed
Refactoring the code
1 parent c6cc71f commit ef26426

File tree

4 files changed

+4
-2
lines changed

4 files changed

+4
-2
lines changed

src/Entity/User.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace PH7\ApiSimpleMenu\Entity;
34

45
class User

src/Service/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function create(mixed $data): array|object
1818
{
1919
$userValidation = new UserValidation($data);
2020
if ($userValidation->isCreationSchemaValid()) {
21-
$userUuid = Uuid::uuid4(); // assigning a UUID to the user
21+
$userUuid = Uuid::uuid4()->toString(); // assigning a UUID to the user
2222

2323
$userEntity = new UserEntity();
2424
$userEntity

src/routes/routes.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55

66
return match ($resource) {
77
'user' => require_once 'user.routes.php',
8+
'item' => require_once 'food-item.routes.php',
89
default => require_once 'not-found.routes.php',
910
};

src/routes/user.routes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function getResponse(): string
2121
$postBody = json_decode($postBody);
2222

2323
// Ternary conditional operator operator
24-
$userId = $_REQUEST['id'] ?? null; // using the null coalescing operator
24+
$userId = $_REQUEST['id'] ?? ''; // using the null coalescing operator
2525

2626
$user = new User();
2727
try {

0 commit comments

Comments
 (0)