PHP Class Hal\Resource

Inheritance: extends AbstractHal
Afficher le fichier Open project: zircote/hal Class Usage Examples

Protected Properties

Свойство Type Description
$_data array Internal storage of primitive types
$_embedded array Internal storage of Resource objects
$_links array Internal storage of Link objects
$jsonNumericCheck boolean

Méthodes publiques

Méthode Description
__construct ( string | SelfLink $href, array $data = [], string | null $title = null, string | null $name = null, string | null $hreflang = null )
__toJson ( ) : string
__toString ( ) : string
getLinks ( ) : array
getSelf ( ) : Link
getXML ( SimpleXMLElemen\SimpleXMLElement | null $xml = null ) : SimpleXMLElement
setData ( $rel, null $data = null ) : Resource
setEmbedded ( string $rel, Resource $resource = null, boolean $singular = false ) : Resource
setJsonNumericCheck ( boolean $jsonNumericCheck = self::JSON_NUMERIC_CHECK_OFF ) : Resource Sets the ability to perform numeric to int conversion of the JSON output.
setLink ( Link $link, boolean $singular = false, boolean $plural = false ) : Resource Add a link to the resource.
setLinks ( array $links, boolean $singular = false, boolean $plural = false ) : Resource Convenience function to set multiple links at once
setXML ( SimpleXMLElement $xml ) : Resource
toArray ( ) : array

Méthodes protégées

Méthode Description
_addData ( SimpleXMLElement $xml, array $data, string $keyOverride = null )
_addLink ( Link $link ) : Resource
_addLinks ( Link $link )
_getEmbRes ( Resource $embed ) : SimpleXMLElement
_getEmbedded ( mixed $embedded, string | null $_rel = null )
_recurseEmbedded ( Resource | null | array $embeded )
_recurseLinks ( array | Link $links )
createLink ( $href, $title, $name, $hreflang ) : Link

Method Details

__construct() public méthode

public __construct ( string | SelfLink $href, array $data = [], string | null $title = null, string | null $name = null, string | null $hreflang = null )
$href string | SelfLink
$data array
$title string | null
$name string | null
$hreflang string | null

__toJson() public méthode

public __toJson ( ) : string
Résultat string

__toString() public méthode

public __toString ( ) : string
Résultat string

_addData() protected méthode

protected _addData ( SimpleXMLElement $xml, array $data, string $keyOverride = null )
$xml SimpleXMLElement
$data array
$keyOverride string

_getEmbRes() protected méthode

protected _getEmbRes ( Resource $embed ) : SimpleXMLElement
$embed Resource
Résultat SimpleXMLElement

_getEmbedded() protected méthode

protected _getEmbedded ( mixed $embedded, string | null $_rel = null )
$embedded mixed
$_rel string | null

_recurseEmbedded() protected méthode

protected _recurseEmbedded ( Resource | null | array $embeded )
$embeded Resource | null | array

getSelf() public méthode

public getSelf ( ) : Link
Résultat Link

getXML() public méthode

public getXML ( SimpleXMLElemen\SimpleXMLElement | null $xml = null ) : SimpleXMLElement
$xml SimpleXMLElemen\SimpleXMLElement | null
Résultat SimpleXMLElement

setData() public méthode

public setData ( $rel, null $data = null ) : Resource
$rel
$data null
Résultat Resource

setEmbedded() public méthode

public setEmbedded ( string $rel, Resource $resource = null, boolean $singular = false ) : Resource
$rel string
$resource Resource
$singular boolean
Résultat Resource

setJsonNumericCheck() public méthode

Example Usage: $hal->setJsonNumericCheck($jsonNumericCheck = self::JSON_NUMERIC_CHECK_OFF); $hal->setJsonNumericCheck($jsonNumericCheck = self::JSON_NUMERIC_CHECK_ON);
public setJsonNumericCheck ( boolean $jsonNumericCheck = self::JSON_NUMERIC_CHECK_OFF ) : Resource
$jsonNumericCheck boolean
Résultat Resource

setXML() public méthode

public setXML ( SimpleXMLElement $xml ) : Resource
$xml SimpleXMLElement
Résultat Resource

toArray() public méthode

public toArray ( ) : array
Résultat array

Property Details

$_data protected_oe property

Internal storage of primitive types
protected array $_data
Résultat array

$_embedded protected_oe property

Internal storage of Resource objects
protected array $_embedded
Résultat array

$jsonNumericCheck protected_oe property

protected bool $jsonNumericCheck
Résultat boolean