Documentation

CreateBookmarkDTO extends AbstractBaseDto
in package
implements DTOInterface

Data Transfer Object for creating Canvas bookmarks

This DTO handles the transformation of bookmark creation data into the format expected by the Canvas API.

Table of Contents

Interfaces

DTOInterface

Properties

$data  : string|null
Additional metadata about the bookmarked item (JSON string)
$name  : string|null
The name/label of the bookmark
$position  : int|null
Position for ordering bookmarks
$url  : string|null
The URL being bookmarked
$apiPropertyName  : string
The API property name for multipart format

Methods

__construct()  : mixed
BaseDto constructor.
fromArray()  : self
Create DTO from array
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
formatMultipartValue()  : mixed
Format a value for multipart form contents

Properties

$data

Additional metadata about the bookmarked item (JSON string)

public string|null $data = null

$apiPropertyName

The API property name for multipart format

protected string $apiPropertyName = 'bookmark'

Methods

__construct()

BaseDto constructor.

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

fromArray()

Create DTO from array

public static fromArray(array<string, mixed> $data) : self
Parameters
$data : array<string, mixed>
Return values
self

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>

formatMultipartValue()

Format a value for multipart form contents

protected static formatMultipartValue(mixed $value) : mixed

Booleans must be converted explicitly: Guzzle's multipart encoder string-casts contents, turning false into an empty string instead of 'false', which Canvas may interpret differently than an unset flag.

Parameters
$value : mixed

The value to format

On this page

Search results