ApiRecord
in package
implements
Stringable
Read onlyYes
AbstractYes
Base class of every record the API returns (Team, Event, ...).
Records are read-only and built by the client from one API record. Every property is read from $raw, so two records are equal (==) when the API sent the same fields. To test code that uses them, fake the HTTP layer (RohanG27\TheSportsDb\Http\Transport) instead of building records.
Table of Contents
Interfaces
- Stringable
Properties
- $raw : array<string|int, mixed>
Methods
- __construct() : mixed
- __toString() : string
- equals() : bool
- True when $other is the same kind of record, built from the same API fields.
- fmt() : string
Properties
$raw
public
array<string|int, mixed>
$raw
Methods
__construct()
public
__construct(array<string, string|null> $raw) : mixed
Parameters
- $raw : array<string, string|null>
-
every field as the API sent it (blank strings as null); use it for fields not modelled yet: $team->raw['strKeywords']
__toString()
public
abstract __toString() : string
Return values
stringequals()
True when $other is the same kind of record, built from the same API fields.
public
equals(self|null $other) : bool
Parameters
- $other : self|null
Return values
boolfmt()
protected
fmt(mixed $value) : string
Parameters
- $value : mixed