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
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
$hidden
Whether the feature flag is hidden from the UI
public
bool|null
$hidden
= null
$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
selfdisable()
Set the feature flag to 'off' state
public
disable() : self
Return values
selfenable()
Set the feature flag to 'on' state
public
enable() : self
Return values
selfgetState()
Get the current state
public
getState() : string|null
Return values
string|nullhide()
Hide the feature flag from the UI
public
hide() : self
Return values
selfisHidden()
Check if the flag is hidden
public
isHidden() : bool|null
Return values
bool|nullisLocked()
Check if the flag is locked
public
isLocked() : bool|null
Return values
bool|nullisValid()
Validate that the DTO has at least one field set
public
isValid() : bool
Return values
boollock()
Lock the feature flag
public
lock() : self
Return values
selfsetHidden()
Set whether the feature flag is hidden
public
setHidden(bool $hidden) : self
Parameters
- $hidden : bool
-
Whether to hide the flag
Return values
selfsetLocked()
Set whether the feature flag is locked
public
setLocked(bool $locked) : self
Parameters
- $locked : bool
-
Whether to lock the flag
Return values
selfsetState()
Set the state of the feature flag
public
setState(string $state) : self
Parameters
- $state : string
-
The state to set ('off', 'allowed', 'on')
Tags
Return values
selfshow()
Show the feature flag in the UI
public
show() : self
Return values
selftoApiArray()
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>>unlock()
Unlock the feature flag
public
unlock() : self
Return values
selfvalidateState()
Validate the state value
protected
validateState(string $state) : void
Parameters
- $state : string
-
The state to validate