Location
extends Entity
in package
Geo location class
This class contains properties to get, set or compare a location and explore the geo classes linked to.
It quickly allows to parse through the location classes in templates and controllers.
Tags
Table of Contents
Properties
- $body : Body
- A body object
- $place : Place|null
- A place object
- $point3D : Point3D|null
- A point identified by x, y, z coordinates
- $ship : Ship
- A ship object
- $data : array<string|int, mixed>
- An array of strings containing location data.
- $db : DatabaseEngine
Methods
- __construct() : mixed
- Initializes a new location instance
- __get() : mixed
- Magic method called when a unknown property is get.
- __set() : mixed
- Magic method called when a unknown property is set.
- __toString() : string
- Represents the current location instance as a string
- equals() : bool
- Checks if the place is equals at the specified expression or place
- exists() : bool
- Checks if the place exists
- getDatabase() : DatabaseEngine
- load_classes() : mixed
- Gets $place, $body and $ship instances if they're needed
- setDatabase() : void
Properties
$body
A body object
public
Body
$body
= null
It contains a GeoBody value when the global location is a body ie if $this->data[0][0] == 'B'
Otherwise, its value is null.
$place
A place object
public
Place|null
$place
= null
It contains a Place value when the global location is a place ie if $this->data[0][0] == 'B' && strlen($this->data[0]) == 9
Otherwise, its value is null.
$point3D
A point identified by x, y, z coordinates
public
Point3D|null
$point3D
= null
$ship
A ship object
public
Ship
$ship
= null
It contains a Ship value when the global location is a ship ie if $this->data[0][0] == 'S'
Otherwise, its value is null.
$data
An array of strings containing location data.
private
array<string|int, mixed>
$data
In the current class implementation, the first element is the global location and the second element is the local location.
$db
private
DatabaseEngine
$db
Methods
__construct()
Initializes a new location instance
public
__construct(DatabaseEngine $db[, string $global = null ][, string $local = null ]) : mixed
Parameters
- $db : DatabaseEngine
- $global : string = null
- $local : string = null
Tags
__get()
Magic method called when a unknown property is get.
public
__get(mixed $variable) : mixed
Handles $global, $local, $type, $body_code, $ship_code, $place_code, $body_kind, $containsGlobalLocation, $containsLocalLocation.
Parameters
- $variable : mixed
__set()
Magic method called when a unknown property is set.
public
__set(mixed $variable, mixed $value) : mixed
Handles $global, $local, $type, $body_code, $ship_code, $place_code
Parameters
- $variable : mixed
- $value : mixed
__toString()
Represents the current location instance as a string
public
__toString() : string
Return values
string —a string representing the current location
equals()
Checks if the place is equals at the specified expression or place
public
equals(mixed $expression) : bool
Parameters
- $expression : mixed
Tags
Return values
bool —true if the places are equals ; otherwise, false.
exists()
Checks if the place exists
public
exists() : bool
Tags
Return values
bool —true if the place exists ; otherwise, false.
getDatabase()
public
getDatabase() : DatabaseEngine
Return values
DatabaseEngineload_classes()
Gets $place, $body and $ship instances if they're needed
public
load_classes() : mixed
setDatabase()
public
setDatabase(DatabaseEngine $db) : void
Parameters
- $db : DatabaseEngine