Apple News API PHP Client

ConditionalComponentTextStyle extends ConditionalTextStyle
in package

FinalYes

Conditional text style for component text.

Alias for ConditionalTextStyle, used in component textStyle contexts.

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

Table of Contents

Methods

addCondition()  : $this
Add a condition.
compactSize()  : self
Create a smaller text style for compact screens.
darkMode()  : self
Create a dark mode text style.
hasConditions()  : bool
Check if any conditions have been set.
jsonSerialize()  : array<string, mixed>
{@inheritdoc}
lightMode()  : self
Create a light mode text style.
setBackgroundColor()  : $this
Set the background color.
setFontName()  : $this
Set the font name.
setFontSize()  : $this
Set the font size.
setFontStyle()  : $this
Set the font style.
setFontWeight()  : $this
Set the font weight.
setFontWidth()  : $this
Set the font width.
setLineHeight()  : $this
Set the line height.
setTextAlignment()  : $this
Set the text alignment.
setTextColor()  : $this
Set the text color.
setTextShadow()  : $this
Set the text shadow.
setTracking()  : $this
Set the tracking (letter spacing).

Methods

compactSize()

Create a smaller text style for compact screens.

public static compactSize(int $fontSize) : self
Parameters
$fontSize : int

The smaller font size.

Return values
self

A new instance.

darkMode()

Create a dark mode text style.

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

The dark mode text 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 text style.

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

The light mode text 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

setFontName()

Set the font name.

public setFontName(string $fontName) : $this
Parameters
$fontName : string

The font name.

Return values
$this

setFontSize()

Set the font size.

public setFontSize(int $size) : $this
Parameters
$size : int

The size in points.

Return values
$this

setFontStyle()

Set the font style.

public setFontStyle(string $style) : $this
Parameters
$style : string

The style ('normal', 'italic', 'oblique').

Return values
$this

setFontWeight()

Set the font weight.

public setFontWeight(int $weight) : $this
Parameters
$weight : int

The weight (100-900).

Return values
$this

setFontWidth()

Set the font width.

public setFontWidth(string $width) : $this
Parameters
$width : string

The width value.

Return values
$this

setLineHeight()

Set the line height.

public setLineHeight(float $height) : $this
Parameters
$height : float

The line height in points.

Return values
$this

setTextAlignment()

Set the text alignment.

public setTextAlignment(string $alignment) : $this
Parameters
$alignment : string

One of 'left', 'center', 'right', 'justified'.

Return values
$this

setTextColor()

Set the text color.

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

The color in hex format.

Return values
$this

setTextShadow()

Set the text shadow.

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

The shadow configuration.

Return values
$this

setTracking()

Set the tracking (letter spacing).

public setTracking(float $tracking) : $this
Parameters
$tracking : float

The tracking value.

Return values
$this

        
On this page

Search results