Port
extends Entity
in package
Port class
This class maps the ports table.
The class also provides helper methods to handle ports at specified location.
Table of Contents
Properties
- $default : mixed
- $hidden : mixed
- $id : mixed
- $lastError : string
- $location_global : mixed
- $location_local : mixed
- $name : mixed
- $requiresPTA : mixed
- $db : DatabaseEngine
Methods
- __construct() : mixed
- Initializes a new instance
- from_location() : Port|null
- Gets default port, from specified global location
- get_port_id() : int|null
- Gets the port situated exactly at the specified global location
- getDatabase() : DatabaseEngine
- getStatus() : string
- Gets status field value
- have_port() : bool
- Determines if the specified location have a port
- load_from_database() : bool
- Loads the object Port (ie fill the properties) from the database
- load_from_form() : mixed
- Loads the object Port (ie fill the properties) from the $_POST array
- save_to_database() : void
- Saves to database
- setDatabase() : void
Properties
$default
public
mixed
$default
$hidden
public
mixed
$hidden
$id
public
mixed
$id
$lastError
public
string
$lastError
= ""
$location_global
public
mixed
$location_global
$location_local
public
mixed
$location_local
$name
public
mixed
$name
$requiresPTA
public
mixed
$requiresPTA
$db
private
DatabaseEngine
$db
Methods
__construct()
Initializes a new instance
public
__construct(DatabaseEngine $db[, int $id = null ]) : mixed
Parameters
- $db : DatabaseEngine
- $id : int = null
from_location()
Gets default port, from specified global location
public
static from_location(DatabaseEngine $db, string $location_global) : Port|null
Parameters
- $db : DatabaseEngine
- $location_global : string
-
the global location
Return values
Port|null —the port near this location ; null if there isn't port there.
get_port_id()
Gets the port situated exactly at the specified global location
public
static get_port_id(DatabaseEngine $db, string $location_global) : int|null
Parameters
- $db : DatabaseEngine
- $location_global : string
-
the global location
Return values
int|null —the port ID, or null if none found
getDatabase()
public
getDatabase() : DatabaseEngine
Return values
DatabaseEnginegetStatus()
Gets status field value
public
getStatus() : string
Return values
string —the status field value (e.g. "requiresPTA,default")
have_port()
Determines if the specified location have a port
public
static have_port(string $location_global) : bool
Parameters
- $location_global : string
-
the global location
Return values
bool —true if there is a spatioport exactly at the specified location ; otherwise, false.
load_from_database()
Loads the object Port (ie fill the properties) from the database
public
load_from_database() : bool
Return values
boolload_from_form()
Loads the object Port (ie fill the properties) from the $_POST array
public
load_from_form() : mixed
save_to_database()
Saves to database
public
save_to_database() : void
setDatabase()
public
setDatabase(DatabaseEngine $db) : void
Parameters
- $db : DatabaseEngine