Documentation

UpdateFeatureFlagDTO extends AbstractBaseDto
in package

Data Transfer Object for updating feature flags in Canvas LMS.

This DTO handles the formatting of feature flag update requests, including state changes and flag settings.

Tags
see
https://canvas.instructure.com/doc/api/feature_flags.html

Table of Contents

Properties

$hidden  : bool|null
Whether the feature flag is hidden from the UI
$locked  : bool|null
Whether the feature flag is locked at this level
$state  : string|null
The state of the feature flag Valid values: 'off', 'allowed', 'on'
$apiPropertyName  : string
The name of the property in the API

Methods

__construct()  : mixed
Constructor to initialize the DTO with data
allow()  : self
Set the feature flag to 'allowed' state
disable()  : self
Set the feature flag to 'off' state
enable()  : self
Set the feature flag to 'on' state
getState()  : string|null
Get the current state
hide()  : self
Hide the feature flag from the UI
isHidden()  : bool|null
Check if the flag is hidden
isLocked()  : bool|null
Check if the flag is locked
isValid()  : bool
Validate that the DTO has at least one field set
lock()  : self
Lock the feature flag
setHidden()  : self
Set whether the feature flag is hidden
setLocked()  : self
Set whether the feature flag is locked
setState()  : self
Set the state of the feature flag
show()  : self
Show the feature flag in the UI
toApiArray()  : array<string|int, mixed>
Convert the DTO to an array for API requests
toArray()  : array<string, mixed>
Convert the DTO to an array
toMultipart()  : array<int, array<string, string>>
Convert the DTO to a multipart array for API requests
unlock()  : self
Unlock the feature flag
validateState()  : void
Validate the state value

Properties

$locked

Whether the feature flag is locked at this level

public bool|null $locked = null

$state

The state of the feature flag Valid values: 'off', 'allowed', 'on'

public string|null $state = null

$apiPropertyName

The name of the property in the API

protected string $apiPropertyName = ''

Methods

__construct()

Constructor to initialize the DTO with data

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

Initial data for the DTO

allow()

Set the feature flag to 'allowed' state

public allow() : self
Return values
self

disable()

Set the feature flag to 'off' state

public disable() : self
Return values
self

getState()

Get the current state

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

isHidden()

Check if the flag is hidden

public isHidden() : bool|null
Return values
bool|null

isLocked()

Check if the flag is locked

public isLocked() : bool|null
Return values
bool|null

isValid()

Validate that the DTO has at least one field set

public isValid() : bool
Return values
bool

setHidden()

Set whether the feature flag is hidden

public setHidden(bool $hidden) : self
Parameters
$hidden : bool

Whether to hide the flag

Return values
self

setLocked()

Set whether the feature flag is locked

public setLocked(bool $locked) : self
Parameters
$locked : bool

Whether to lock the flag

Return values
self

setState()

Set the state of the feature flag

public setState(string $state) : self
Parameters
$state : string

The state to set ('off', 'allowed', 'on')

Tags
throws
InvalidArgumentException

If the state is invalid

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, mixed>
Return values
array<string, mixed>

toMultipart()

Convert the DTO to a multipart array for API requests

public toMultipart() : array<int, array<string, string>>
Return values
array<int, array<string, string>>

validateState()

Validate the state value

protected validateState(string $state) : void
Parameters
$state : string

The state to validate

Tags
throws
InvalidArgumentException

If the state is invalid


        
On this page

Search results