UpdateMediaTracksDTO
extends AbstractBaseDto
in package
UpdateMediaTracksDTO
Data Transfer Object for updating MediaTracks
Table of Contents
Constants
- VALID_KINDS = ['subtitles', 'captions', 'descriptions', 'chapters', 'metadata']
- Valid track kinds
Properties
- $tracks : array<string|int, array<string, mixed>>
- $apiPropertyName : string
- The name of the property in the API
Methods
- __construct() : mixed
- Constructor
- addTrack() : self
- Add a track to the DTO
- clearTracks() : self
- Clear all tracks
- fromArray() : self
- Create DTO from array
- toApiArray() : array<string|int, mixed>
- Convert the DTO to an array for API requests
- toArray() : array<string|int, array<string, mixed>>
- Convert the DTO to an array for API request
- validate() : void
- Validate the DTO data
Constants
VALID_KINDS
Valid track kinds
private
mixed
VALID_KINDS
= ['subtitles', 'captions', 'descriptions', 'chapters', 'metadata']
Properties
$tracks
public
array<string|int, array<string, mixed>>
$tracks
= []
$apiPropertyName
The name of the property in the API
protected
string
$apiPropertyName
= ''
Methods
__construct()
Constructor
public
__construct([array<string|int, array<string, mixed>> $tracks = [] ]) : mixed
Parameters
- $tracks : array<string|int, array<string, mixed>> = []
-
Array of track data
addTrack()
Add a track to the DTO
public
addTrack(string $locale[, string|null $content = null ][, string|null $kind = null ]) : self
Parameters
- $locale : string
-
The locale code
- $content : string|null = null
-
The track content (SRT format)
- $kind : string|null = null
-
The track kind
Return values
selfclearTracks()
Clear all tracks
public
clearTracks() : self
Return values
selffromArray()
Create DTO from array
public
static fromArray(array<string|int, array<string, mixed>> $data) : self
Parameters
- $data : array<string|int, array<string, mixed>>
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 for API request
public
toArray() : array<string|int, array<string, mixed>>
Return values
array<string|int, array<string, mixed>>validate()
Validate the DTO data
protected
validate() : void