Apple News API PHP Client

AutoPlacement
in package
implements JsonSerializable

FinalYes

Auto-placement configuration for automatic component insertion.

The AutoPlacement object controls how advertisements and other components are automatically placed throughout the article.

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

Table of Contents

Interfaces

JsonSerializable

Properties

$advertisement  : AdvertisementAutoPlacement|null
Advertisement auto-placement configuration.
$conditional  : array<int, array<string, mixed>>|null
Conditional auto-placement configurations.

Methods

addConditional()  : $this
Add a conditional auto-placement.
isEmpty()  : bool
Check if the auto-placement has any configuration.
jsonSerialize()  : array<string, mixed>
{@inheritdoc}
setAdvertisement()  : $this
Set the advertisement auto-placement.
setConditional()  : $this
Set conditional auto-placements.
withAdFrequency()  : self
Create an AutoPlacement with specific ad frequency.
withAdsDisabled()  : self
Create an AutoPlacement with ads disabled.

Properties

$conditional

Conditional auto-placement configurations.

private array<int, array<string, mixed>>|null $conditional = null

Methods

isEmpty()

Check if the auto-placement has any configuration.

public isEmpty() : bool
Return values
bool —

True if any configuration is set.

jsonSerialize()

{@inheritdoc}

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

setConditional()

Set conditional auto-placements.

public setConditional(array<int, array<string, mixed>> $conditional) : $this
Parameters
$conditional : array<int, array<string, mixed>>

Array of conditional placements.

Return values
$this

withAdFrequency()

Create an AutoPlacement with specific ad frequency.

public static withAdFrequency(int $frequency) : self
Parameters
$frequency : int

Number of components between ads.

Return values
self —

A new AutoPlacement instance.

withAdsDisabled()

Create an AutoPlacement with ads disabled.

public static withAdsDisabled() : self
Return values
self —

A new AutoPlacement instance.


        
On this page

Search results