Documentation

AbstractBaseDto
in package

AbstractYes

Abstract base class for Data Transfer Objects (DTOs).

Provides common functionality for all DTO classes including data population, array transformation for Canvas API multipart format, and date/time handling. DTOs are used to format and validate data before sending to the Canvas API.

Table of Contents

Properties

$apiPropertyName  : string
The name of the property in the API

Methods

__construct()  : mixed
BaseDto constructor.
toApiArray()  : array<string|int, mixed>
Convert the DTO to an array for API requests
toArray()  : array<string|int, mixed>
Convert the DTO to an array
cast()  : DateTime|mixed
Cast the value to the correct type

Properties

$apiPropertyName

The name of the property in the API

protected string $apiPropertyName = ''

Methods

__construct()

BaseDto constructor.

public __construct(array<string|int, mixed> $data) : mixed
Parameters
$data : array<string|int, mixed>
Tags
throws
Exception

toApiArray()

Convert the DTO to an array for API requests

public toApiArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

toArray()

Convert the DTO to an array

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

cast()

Cast the value to the correct type

private cast(mixed $value, string $key) : DateTime|mixed
Parameters
$value : mixed
$key : string
Tags
throws
Exception
Return values
DateTime|mixed

        
On this page

Search results