Warning
in package
FinalYes
Warning message returned by the Apple News API for non-fatal issues.
Warnings indicate problems that did not prevent the request from succeeding, but may affect how the article appears or behaves. You should review warnings and address them when possible.
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- Create a new Warning instance.
- fromArray() : self
- Create a Warning instance from API response data.
- fromArrayList() : array<int, self>
- Create multiple Warning instances from an array of warning data.
Properties
$code read-only
public
string
$code
$keyPath read-only
public
string|null
$keyPath
= null
$message read-only
public
string|null
$message
= null
Methods
__construct()
Create a new Warning instance.
public
__construct(string $code[, string|null $keyPath = null ][, string|null $message = null ]) : mixed
Parameters
- $code : string
-
The warning code identifying the type of warning.
- $keyPath : string|null = null
-
The path to the field that triggered the warning, if applicable.
- $message : string|null = null
-
A human-readable description of the warning.
fromArray()
Create a Warning instance from API response data.
public
static fromArray(array<string, mixed> $data) : self
Parameters
- $data : array<string, mixed>
-
The warning data from the API response.
Return values
self —A new Warning instance populated with the response data.
fromArrayList()
Create multiple Warning instances from an array of warning data.
public
static fromArrayList(array<int, array<string, mixed>> $warnings) : array<int, self>
Parameters
- $warnings : array<int, array<string, mixed>>
-
Array of warning data from the API response.
Return values
array<int, self> —List of Warning instances.