pfSense-pkg-RESTAPI

ResourceLink
in package
uses BaseTraits

Defines a ResourceLink object that represents a HAL link object. These objects are primarily used by Endpoint classes to populate HAL links for objects that are related to the API call the Endpoint is serving.

Tags
link
https://stateless.group/hal_specification.html

Table of Contents

Properties

$custom_attributes  : array<string|int, mixed>
$href  : string
$method  : string
$rel  : string
$use_namespace  : bool
$__log_level  : int

Methods

__construct()  : mixed
Constructs a new HAL ResourceLink 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 this object to an array representation.

Properties

$custom_attributes

public array<string|int, mixed> $custom_attributes
Tags
@var

$custom_attributes array Defines custom attributes to include in the link object. Any custom attributes defined should be well documented. For example, the "title" attribute is a common custom HAL attribute.

Methods

__construct()

Constructs a new HAL ResourceLink object.

public __construct(string $rel, string $href[, string $method = 'GET' ][, bool $use_namespace = true ], mixed ...$custom_attributes) : mixed
Parameters
$rel : string

The HAL related resource name for this ResourceLink. This name should accurately represent the relationship between the current resource and the linked resource. Any non-started related resource names should be well documented.

$href : string

The URL to the linked resource. This should include any required query/path parameters required to locate the linked resource.

$method : string = 'GET'

The HTTP method that should be used when making requests to the $href for this link

$use_namespace : bool = true

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.

$custom_attributes : mixed

Provide any custom attributes that should be included with this resource link. Any custom attributes provided should be well documented.

Tags
link
https://stateless.group/hal_specification.html

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 this object to an array representation.

public to_representation() : array<string|int, mixed>
Tags
returns

array An array representation of this HAL resource link.

Return values
array<string|int, mixed>

        
On this page

Search results