33 lines
1.3 KiB
PHP
33 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
/*
|
|
// MODULE_CONTRACT: Defines the data structure for an address.
|
|
// RESPONSIBILITY: To hold and type-safely represent address details.
|
|
// INPUTS: Raw JSON object from the API response or internal input.
|
|
// OUTPUTS: A structured object containing address information.
|
|
// LINKS: CreateBeneficiaryRequestData.php (uses this DTO)
|
|
*/
|
|
|
|
namespace Apoloz\AlfaBank\Data\NominalAccounts\Beneficiaries;
|
|
|
|
// <SECTION name="module_imports" intent="Import the base Spatie Laravel Data class.">
|
|
// <BELIEF_STATE "Extending `Spatie\LaravelData\Data` enables automatic casting from JSON and provides other DTO benefits.">
|
|
use Spatie\LaravelData\Data;
|
|
|
|
// </SECTION>
|
|
|
|
// <SECTION name="class_definition" intent="Define a DTO for address details.">
|
|
// <BELIEF_STATE "This DTO provides a clear, type-safe contract for address data, ensuring consistency whenever address information is exchanged.">
|
|
class AddressData extends Data
|
|
{
|
|
// <SECTION name="constructor_properties" intent="Define the properties of an address.">
|
|
// <BELIEF_STATE "The constructor captures the `type` of address (e.g., legal, postal), the `address` string itself, and an optional `country`.">
|
|
public function __construct(
|
|
public string $type,
|
|
public string $address,
|
|
public ?string $country = null,
|
|
) {}
|
|
// </SECTION>
|
|
}
|