Properties

$version

$version : 

Type

$identifier

$identifier : 

Type

$title

$title : 

Type

$language

$language : 

Type

$layout

$layout : 

Type

$components

$components : 

Type

$componentTextStyles

$componentTextStyles : 

Type

$subtitle

$subtitle : 

Type

$metadata

$metadata : 

Type

$documentStyle

$documentStyle : 

Type

$textStyles

$textStyles : 

Type

$componentStyles

$componentStyles : 

Type

$componentLayouts

$componentLayouts : 

Type

$baseIdentifier

$baseIdentifier : 

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(mixed  $identifier, mixed  $title, mixed  $language, \ChapterThree\AppleNewsAPI\Document\Layouts\Layout  $layout) 

Implements __construct().

Parameters

mixed $identifier

Identifier.

mixed $title

Title.

mixed $language

Language.

\ChapterThree\AppleNewsAPI\Document\Layouts\Layout $layout

Layout.

getVersion()

getVersion() 

Getter for version.

getIdentifier()

getIdentifier() 

Getter for identifier.

setIdentifier()

setIdentifier(mixed  $identifier) : $this

Setter for identifier.

Parameters

mixed $identifier

Identifier.

Returns

$this

getTitle()

getTitle() 

Getter for title.

setTitle()

setTitle(mixed  $title) : $this

Setter for title.

Parameters

mixed $title

Title.

Returns

$this

getLanguage()

getLanguage() 

Getter for language.

setLanguage()

setLanguage(mixed  $language) : $this

Setter for language.

Parameters

mixed $language

Language.

Returns

$this

getComponents()

getComponents() : array

Getter for child components.

Returns

array —

List of \ChapterThree\AppleNewsAPI\Document\Components\Component.

getComponentsFlattened()

getComponentsFlattened() : array

Gets nested components as a flattened list.

Returns

array —

List of \ChapterThree\AppleNewsAPI\Document\Components\Component.

getComponentTextStyles()

getComponentTextStyles() 

Getter for componentTextStyles.

addComponentTextStyle()

addComponentTextStyle(mixed  $name, \ChapterThree\AppleNewsAPI\Document\Styles\ComponentTextStyle  $component_text_style) : $this

Setter for componentTextStyles.

Parameters

mixed $name

Name.

\ChapterThree\AppleNewsAPI\Document\Styles\ComponentTextStyle $component_text_style

ComponentTextStyle.

Returns

$this

getSubtitle()

getSubtitle() 

Getter for subtitle.

setSubtitle()

setSubtitle(mixed  $subtitle) : $this

Setter for subtitle.

Parameters

mixed $subtitle

Subtitle.

Returns

$this

getMetadata()

getMetadata() 

Getter for metadata.

getDocumentStyle()

getDocumentStyle() 

Getter for documentStyle.

getTextStyles()

getTextStyles() 

Getter for textStyles.

getComponentStyles()

getComponentStyles() 

Getter for componentStyles.

addComponentStyle()

addComponentStyle(mixed  $name, \ChapterThree\AppleNewsAPI\Document\Styles\ComponentStyle  $component_style) : $this

Setter for componentStyles.

Parameters

mixed $name

Name.

\ChapterThree\AppleNewsAPI\Document\Styles\ComponentStyle $component_style

ComponentStyle.

Returns

$this

getComponentLayouts()

getComponentLayouts() 

Getter for componentLayouts.

addComponentLayout()

addComponentLayout(mixed  $name, \ChapterThree\AppleNewsAPI\Document\Layouts\ComponentLayout  $component_layout) : $this

Setter for componentLayouts.

Parameters

mixed $name

Name.

\ChapterThree\AppleNewsAPI\Document\Layouts\ComponentLayout $component_layout

ComponentLayout.

Returns

$this

generateIdentifier()

generateIdentifier() 

Generates a unique identifier in this document.

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.