StorySection
in package
Story section class
This class is a PHP mapping from the Story XML format's
This class also a method to get the section where a specific choice links to.
Table of Contents
Properties
- $choices : array<string|int, mixed>
- $description : string
- The section description
- $hooks : mixed
- $id : string
- The section ID
- $location_local : string
- $start : bool
- $story : Story
- $title : string
- The section title
Methods
- __construct() : mixed
- Initializes a new instance of StorySection class
- from_xml() : StorySection
- Initializes a story section from an SimpleXMLElement XML fragment
- get_choice() : StoryChoice
- Gets choice from specified guid
Properties
$choices
public
array<string|int, mixed>
$choices
= []
the section choices (array of StoryChoice items)
$description
The section description
public
string
$description
$hooks
public
mixed
$hooks
= []
$id
The section ID
public
string
$id
$location_local
public
string
$location_local
the local location
$start
public
bool
$start
if true, it's the story start ; otherwise, false;
$story
public
Story
$story
the story calling the section
$title
The section title
public
string
$title
Methods
__construct()
Initializes a new instance of StorySection class
public
__construct(mixed $id[, mixed $story = null ]) : mixed
Parameters
- $id : mixed
- $story : mixed = null
from_xml()
Initializes a story section from an SimpleXMLElement XML fragment
public
static from_xml(SimpleXMLElement $xml[, Story $story = null ]) : StorySection
Parameters
- $xml : SimpleXMLElement
-
the XML fragment
- $story : Story = null
-
the calling story
Return values
StorySection —the section instance
get_choice()
Gets choice from specified guid
public
get_choice(mixed $guid) : StoryChoice
Parameters
- $guid : mixed
Return values
StoryChoice —the wanted choice, or null if it doesn't exist