Link
API reference › yii › web › Link
Link represents a link object as defined in JSON Hypermedia API Language.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$href | string | A URI RFC3986 or URI template RFC6570. Default: null. | Link |
$hreflang | string | The language of the target resource Default: null. | Link |
$name | string | A secondary key for selecting Link Objects which share the same relation type Default: null. | Link |
$profile | string | A URI that hints about the profile of the target resource. Default: null. | Link |
$templated | bool | A value indicating whether $href refers to a URI or URI template. Default: false. | Link |
$title | string | A label describing the link Default: null. | Link |
$type | string | A hint to indicate the media type expected when dereferencing the target resource Default: null. | Link |
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Constructor. | yii\ |
__call() | Calls the named method which is not a class method. | yii\ |
__get() | Returns the value of an object property. | yii\ |
__isset() | Checks if a property is set, i.e. defined and not null. | yii\ |
__set() | Sets value of an object property. | yii\ |
__unset() | Sets an object property to null. | yii\ |
canGetProperty() | Returns a value indicating whether a property can be read. | yii\ |
canSetProperty() | Returns a value indicating whether a property can be set. | yii\ |
className() static | Returns the fully qualified name of this class. | yii\ |
hasMethod() | Returns a value indicating whether a method is defined. | yii\ |
hasProperty() | Returns a value indicating whether a property is defined. | yii\ |
init() | Initializes the object. | yii\ |
serialize() static | Serializes a list of links into proper array format. | Link |
Constants
Section titled “Constants”| Constant | Value | Description | Defined by |
|---|---|---|---|
REL_SELF | 'self' | The self link. | Link |
Property details
Section titled “Property details”$href
Section titled “$href ”public string $href = nullA URI RFC3986 or URI template RFC6570.
This property is required.
Method details
Section titled “Method details”serialize()
Section titled “serialize() ”public static function serialize(array $links): arraySerializes a list of links into proper array format.
Parameters
| Parameter | Type | Description |
|---|---|---|
$links | array | The links to be serialized |
Returns
array: The proper array representation of the links.