Apple News API PHP Client

ConditionalDocumentStyle
in package
implements ConditionalInterface

FinalYes

Conditional properties for document styles.

Allows document-level style properties to change based on conditions, typically used for dark mode support.

Tags
see
https://developer.apple.com/documentation/apple_news/conditionaldocumentstyle

Table of Contents

Interfaces

ConditionalInterface
Interface for all conditional objects.

Properties

$backgroundColor  : string|null
The background color.
$conditions  : array<int, Condition>
The conditions that must be met.

Methods

addCondition()  : $this
Add a condition.
darkMode()  : self
Create a dark mode document style.
hasConditions()  : bool
Check if any conditions have been set.
jsonSerialize()  : array<string, mixed>
{@inheritdoc}
lightMode()  : self
Create a light mode document style.
setBackgroundColor()  : $this
Set the background color.

Properties

Methods

darkMode()

Create a dark mode document style.

public static darkMode([string $backgroundColor = '#1C1C1E' ]) : self
Parameters
$backgroundColor : string = '#1C1C1E'

The dark mode background color.

Return values
self

A new instance.

hasConditions()

Check if any conditions have been set.

public hasConditions() : bool
Return values
bool

True if conditions exist.

jsonSerialize()

{@inheritdoc}

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

lightMode()

Create a light mode document style.

public static lightMode([string $backgroundColor = '#FFFFFF' ]) : self
Parameters
$backgroundColor : string = '#FFFFFF'

The light mode background color.

Return values
self

A new instance.

setBackgroundColor()

Set the background color.

public setBackgroundColor(string $color) : $this
Parameters
$color : string

The color in hex format.

Return values
$this

        
On this page

Search results