StoryChoice
in package
Story choice class
This class is a PHP mapping from the Story XML format's
$xml = "Descendre vers le centre ville ";
$parser = new SimpleXmlElement($xml);
$choice = StoryChoice::from_xml($parser);
echo $choice->text; //That will output Descendre vers le centre ville
echo $choice->goto; //That will output city.entry
echo $choice->guid; //That will output any guid generated for this instance
$thesamechoice = StoryChoice::from_xml($parser);
echo $thesamechoice->guid; //That will output another guid
Table of Contents
Properties
- $goto : string
- The section key this choice links to
- $guid : string
- The choice GUID
- $text : string
- The choice text
Methods
- __construct() : mixed
- Constructor
- __toString() : string
- Gets the story text as a string representation of the class
- from_xml() : StoryChoice
- Initializes a new instance of StoryChoice class from a XML element
Properties
$goto
The section key this choice links to
public
string
$goto
$guid
The choice GUID
public
string
$guid
It will be automatically generated by the constructor, and so is an ephemeral data for this StoryChoice instance.
Tags
$text
The choice text
public
string
$text
Methods
__construct()
Constructor
public
__construct() : mixed
__toString()
Gets the story text as a string representation of the class
public
__toString() : string
Return values
string —The story text
from_xml()
Initializes a new instance of StoryChoice class from a XML element
public
static from_xml(mixed $xml) : StoryChoice
Parameters
- $xml : mixed
Return values
StoryChoice —the story choice class