forked from apoloz/alfa-bank-sdk
refactor(core): enhance SDK structure and documentation
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
@@ -1,14 +1,29 @@
|
||||
<?php
|
||||
/*
|
||||
// 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>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user