Documentation

Avatar
in package

Avatar option object

Represents an available avatar option for a user in Canvas LMS. Users can choose from multiple avatar options or upload their own.

Table of Contents

Properties

$contentType  : string|null
$displayName  : string|null
$filename  : string|null
$id  : int|null
$size  : int|null
$token  : string|null
$type  : string
$url  : string|null

Methods

__construct()  : mixed
Constructor
getHumanReadableSize()  : string|null
Get avatar size info (for attachment type)
isAttachment()  : bool
Check if this is an attachment avatar
isGravatar()  : bool
Check if this is a Gravatar
isSocialMedia()  : bool
Check if this is a social media avatar
toArray()  : array<string, mixed>
Convert to array

Properties

$contentType

public string|null $contentType = null

Content type of the avatar image

$displayName

public string|null $displayName = null

Display name for the avatar option

$filename

public string|null $filename = null

Filename of the avatar (for attachment type)

$id

public int|null $id = null

Avatar ID (for attachment type)

$size

public int|null $size = null

Size in bytes (for attachment type)

$token

public string|null $token = null

Token for selecting this avatar

$type

public string $type

Avatar type (e.g., 'attachment', 'gravatar', 'twitter', 'facebook')

$url

public string|null $url = null

URL to the avatar image

Methods

__construct()

Constructor

public __construct([array<string, mixed> $data = [] ]) : mixed
Parameters
$data : array<string, mixed> = []

getHumanReadableSize()

Get avatar size info (for attachment type)

public getHumanReadableSize() : string|null
Return values
string|null

Human readable size

isAttachment()

Check if this is an attachment avatar

public isAttachment() : bool
Return values
bool

isGravatar()

Check if this is a Gravatar

public isGravatar() : bool
Return values
bool

isSocialMedia()

Check if this is a social media avatar

public isSocialMedia() : bool
Return values
bool

toArray()

Convert to array

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

        
On this page

Search results