Apple News API PHP Client

ConditionalComponentStyle
in package
implements ConditionalInterface

FinalYes

Conditional properties for component styles.

Allows style properties like backgroundColor, border, and opacity to change based on conditions.

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

Table of Contents

Interfaces

ConditionalInterface
Interface for all conditional objects.

Properties

$backgroundColor  : string|null
The background color.
$border  : array<string, mixed>|null
The border configuration.
$conditions  : array<int, Condition>
The conditions that must be met.
$fill  : array<string, mixed>|null
The fill configuration.
$mask  : array<string, mixed>|null
The mask configuration.
$opacity  : float|null
The opacity (0.0 to 1.0).
$shadow  : array<string, mixed>|null
The shadow configuration.

Methods

addCondition()  : $this
Add a condition.
darkMode()  : self
Create a dark mode style.
hasConditions()  : bool
Check if any conditions have been set.
jsonSerialize()  : array<string, mixed>
{@inheritdoc}
lightMode()  : self
Create a light mode style.
setBackgroundColor()  : $this
Set the background color.
setBorder()  : $this
Set the border configuration.
setFill()  : $this
Set the fill configuration.
setMask()  : $this
Set the mask configuration.
setOpacity()  : $this
Set the opacity.
setShadow()  : $this
Set the shadow configuration.

Properties

Methods

darkMode()

Create a dark mode style.

public static darkMode(string $backgroundColor) : self
Parameters
$backgroundColor : string

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 style.

public static lightMode(string $backgroundColor) : self
Parameters
$backgroundColor : string

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

setBorder()

Set the border configuration.

public setBorder(array<string, mixed> $border) : $this
Parameters
$border : array<string, mixed>

The border configuration.

Return values
$this

setFill()

Set the fill configuration.

public setFill(array<string, mixed> $fill) : $this
Parameters
$fill : array<string, mixed>

The fill configuration.

Return values
$this

setMask()

Set the mask configuration.

public setMask(array<string, mixed> $mask) : $this
Parameters
$mask : array<string, mixed>

The mask configuration.

Return values
$this

setOpacity()

Set the opacity.

public setOpacity(float $opacity) : $this
Parameters
$opacity : float

Opacity from 0.0 to 1.0.

Return values
$this

setShadow()

Set the shadow configuration.

public setShadow(array<string, mixed> $shadow) : $this
Parameters
$shadow : array<string, mixed>

The shadow configuration.

Return values
$this

        
On this page

Search results