ResourceLinkSet
in package
uses
BaseTraits
Defines a class that allows the storage and processing of many ResourceLink objects at once.
Table of Contents
Properties
- $rel : string
- $resource_links : array<string|int, mixed>
- $use_namespace : bool
- $__log_level : int
Methods
- __construct() : mixed
- Constructs a new ResourceLinkSet object
- get_class_fqn() : string
- Obtains the fully qualified name of the called class.
- get_class_shortname() : string
- Obtains the shortname of the called class.
- get_classes_in_namespace() : array<string|int, mixed>
- Obtains all classes associated with this class's current namespace.
- log() : void
- Writes a log entry to the applicable log file
- to_representation() : array<string|int, mixed>
- Converts all ResourceLink objects in this ResourceLinkSet into their representation values.
Properties
$rel
public
string
$rel
= '_links'
$resource_links
public
array<string|int, mixed>
$resource_links
= []
$use_namespace
public
bool
$use_namespace
= false
$__log_level
private
static int
$__log_level
Methods
__construct()
Constructs a new ResourceLinkSet object
public
__construct([array<string|int, mixed> $resource_links = [] ][, string $rel = '_links' ][, bool $use_namespace = false ]) : mixed
Parameters
- $resource_links : array<string|int, mixed> = []
-
An array of ResourceLink objects to include in this ResourceLinkSet
- $rel : string = '_links'
-
The HAL related resource name for this ResourceLinkSet. This allows many ResourceLink objects to represented under a single related resource name. If a value is specified here, this ResourceLinkSet is expected to be nested within a root ResourceLinkSet that does not have this value defined.
- $use_namespace : bool = false
-
Set to true to prefix the HAL namespace for this package to the $rel value or set to false to use the $rel value directly. Unless $rel is a standard HAL related resource name, this should be set to true.
get_class_fqn()
Obtains the fully qualified name of the called class.
public
static get_class_fqn() : string
Return values
string —The FQN for this object's class.
get_class_shortname()
Obtains the shortname of the called class.
public
static get_class_shortname() : string
Return values
string —The shortname for this object's class.
get_classes_in_namespace()
Obtains all classes associated with this class's current namespace.
public
get_classes_in_namespace([bool $shortnames = false ]) : array<string|int, mixed>
Parameters
- $shortnames : bool = false
Return values
array<string|int, mixed> —An array of classes currently in this object's namespace
log()
Writes a log entry to the applicable log file
public
static log(int $level, string $message[, string $logfile = 'restapi' ]) : void
Parameters
- $level : int
-
The log level to write. This should be one of the LOG_* constants defined by syslog.
- $message : string
-
The message to write to the log file.
- $logfile : string = 'restapi'
-
The log file to write to. This must be a valid logging facility defined in the package's info.xml file.
to_representation()
Converts all ResourceLink objects in this ResourceLinkSet into their representation values.
public
to_representation() : array<string|int, mixed>