31 lines
652 B
PHP
31 lines
652 B
PHP
<?php
|
|
|
|
namespace App\Data;
|
|
|
|
use App\Contracts\OutputDataTransferObject;
|
|
|
|
final readonly class UserDTO implements OutputDataTransferObject
|
|
{
|
|
public function __construct(
|
|
public int $id,
|
|
public string $name,
|
|
public string $email,
|
|
public string $mobileNumber,
|
|
public string $city,
|
|
) {}
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'name' => $this->name,
|
|
'email' => $this->email,
|
|
'mobileNumber' => $this->mobileNumber,
|
|
'city' => $this->city,
|
|
];
|
|
}
|
|
}
|