Documentation

NamedUri implements ArrayCopyable, Arrayable, Jsonable Uses ArrayTrait, JsonTrait

Named URI.

Tags
since
1.8

Interfaces, Classes and Traits

ArrayCopyable
Interface to declare instances can be converted into/from arrays.
Arrayable
Interface to declare that instances can be converted into an array.
Jsonable
Interface to declare that instances can be converted into JSON strings.

Table of Contents

__construct()  : mixed
Constructor.
copyFromArray()  : mixed
Copy the content of the given array into this object.
copyToArray()  : mixed
Copy the content of this object into the given array.
fromArray()  : static
Convert an array into an instance of this class.
fromJson()  : static
Convert a JSON string into an instance of this class.
getName()  : string
Get the name of the URI.
getUri()  : string
Get the URI.
setName()  : NamedUri
Set the name of the URI.
setUri()  : NamedUri
Set the URI.
toArray()  : array<string|int, mixed>
Convert this object into an array.
toJson()  : string
Convert this object into a JSON string.

Methods

__construct()

Constructor.

public __construct([string $name = null ][, string $uri = null ]) : mixed
Parameters
$name : string = null

The name of the URI.

$uri : string = null

The URI.

Return values
mixed

copyFromArray()

Copy the content of the given array into this object.

public copyFromArray(array<string|int, mixed> &$array) : mixed
Parameters
$array : array<string|int, mixed>
Return values
mixed

copyToArray()

Copy the content of this object into the given array.

public copyToArray(array<string|int, mixed> &$array) : mixed
Parameters
$array : array<string|int, mixed>
Return values
mixed

fromArray()

Convert an array into an instance of this class.

public static fromArray([array<string|int, mixed> $array = null ]) : static

This static function returns a new instance of this class. If $array is null, null is returned.

Parameters
$array : array<string|int, mixed> = null

An array

Return values
static

An instance of this class.

fromJson()

Convert a JSON string into an instance of this class.

public static fromJson(string $json) : static

This static function returns a new instance of this class. If $json is null or the type of $json is not string, null is returned.

Parameters
$json : string

A JSON string.

Return values
static

An instance of this class.

getName()

Get the name of the URI.

public getName() : string
Return values
string

The name of the URI.

getUri()

Get the URI.

public getUri() : string
Return values
string

The URI.

setName()

Set the name of the URI.

public setName(string $name) : NamedUri
Parameters
$name : string

The name of the URI.

Return values
NamedUri

$this object.

setUri()

Set the URI.

public setUri(string $uri) : NamedUri
Parameters
$uri : string

The URI.

Return values
NamedUri

$this object.

toArray()

Convert this object into an array.

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

An array.

toJson()

Convert this object into a JSON string.

public toJson(int $options) : string
Parameters
$options : int

Options passed to json_encode(). This parameter is optional and its default value is 0.

Return values
string

A JSON string.

Search results