\ChapterThree\AppleNewsAPI\Document\Styles\Fills\GradientsColorStop

An Apple News Document GradientFill.

Summary

Methods
Properties
Constants
jsonSerialize()
__toString()
json()
triggerError()
__construct()
getColor()
setColor()
getLocation()
setLocation()
No public properties found
No constants found
optional()
isSupportedUnit()
isUnitInterval()
isHexColor()
$color
$location
N/A
No private methods found
No private properties found
N/A

Properties

$color

$color : 

Type

$location

$location : 

Type

Methods

jsonSerialize()

jsonSerialize() 

Implements JsonSerializable::jsonSerialize().

__toString()

__toString() 

Implements __toString().

json()

json() : boolean|string

Generates json representation.

Returns

boolean|string —

JSON string, or FALSE on error.

triggerError()

triggerError(string  $message, integer  $message_type = E_USER_NOTICE) 

Error handler.

Parameters

string $message

Message.

integer $message_type

Matching E_USER_ERROR|E_USER_WARNING|E_USER_NOTICE|E_USER_DEPRECATED.

__construct()

__construct(string  $color) 

Implements __construct().

Parameters

string $color

getColor()

getColor() 

Getter for color.

setColor()

setColor(string  $value) : $this

Setter for color.

Parameters

string $value

The color of this color stop, defined as a 3- to 8-character RGBA hexadecimal string; e.g., #000 for black or #FF00007F for red with an alpha (opacity) of 50%.

Returns

$this

getLocation()

getLocation() 

Getter for location.

setLocation()

setLocation(float  $value) : $this

Setter for location.

Parameters

float $value

An optional location of the color stop within the gradient, as a percentage of the gradient size. If location is omitted, the length of the stop is calculated by first subtracting color stops with specified locations from the full length, then equally distributing the remaining length.

Returns

$this

optional()

optional() 

Define optional properties.

isSupportedUnit()

isSupportedUnit(mixed  $value) : boolean

Helper function to determine if a value is suffixed by a supported unit.

Parameters

mixed $value

Value.

Returns

boolean —

Result.

isUnitInterval()

isUnitInterval(float|integer  $value) : boolean

Helper function to determine if a value is a unit interval.

A unit interval is the closed interval [0,1], that is, the set of all real numbers that are greater than or equal to 0 and less than or equal to 1.

Parameters

float|integer $value

Value.

Returns

boolean —

Result.

isHexColor()

isHexColor(string  $value) : boolean

Helper to validate color hex code.

Valid codes are hexadecimal numbers of length 3, 6 or 8 (with opacity), prefixed with "#".

Parameters

string $value

Value.

Returns

boolean —

Result.