Story
in package
Story class
This class is a PHP mapping from the Story XML format.
This class also provides a collection of helper methods to explore the story.
Table of Contents
Properties
- $file : string
- The file path
- $sections : array<string|int, mixed>
- An array of StorySection elements
- $title : string
- The story title
- $sectionsByLocation : array<string|int, mixed>
- An array of StorySection elements, indexed by location
- $startSection : string
- The index of start section in sections array
- $xml : SimpleXMLElement
- The SimpleXML parser
Methods
- __construct() : mixed
- get_section_from_location() : StorySection
- Gets section from local location
- get_start_section() : StorySection
- Gets start section
- parse() : mixed
- Parses XML file
Properties
$file
The file path
public
string
$file
$sections
An array of StorySection elements
public
array<string|int, mixed>
$sections
= []
$title
The story title
public
string
$title
$sectionsByLocation
An array of StorySection elements, indexed by location
private
array<string|int, mixed>
$sectionsByLocation
= []
$startSection
The index of start section in sections array
private
string
$startSection
= \null
$xml
The SimpleXML parser
private
SimpleXMLElement
$xml
Methods
__construct()
public
__construct(mixed $file) : mixed
Parameters
- $file : mixed
get_section_from_location()
Gets section from local location
public
get_section_from_location(mixed $location) : StorySection
Parameters
- $location : mixed
Return values
StorySection —the default section at this location, or null if not defined
get_start_section()
Gets start section
public
get_start_section() : StorySection
Return values
StorySection —the section where the story starts, or null if not defined
parse()
Parses XML file
public
parse() : mixed