Route
extends Element
in package
Uses
ElementTrait, IdentifiableElementTrait, EnumResolverTrait, ThemeTrait
This is the Route class.
The API Routes will be stored in that class and will remain immutable (only get methods are available)
Tags
Table of Contents
$error | : Error|null | |
---|---|---|
$id | Autonumeric element id. | : int |
$type | : string | |
__construct() | Elements constructor. | : mixed |
__toString() | Uses "json_encode" function to return the JSON format of the element. | : string |
getAlternates() | Returns the route alternates. | : array<string|int, HrefLang> |
getAvailableLanguages() | Returns the route available languages. | : array<string|int, LanguageRoute> |
getBreadcrumb() | Returns the route breadcrumb. | : array<string|int, Breadcrumb> |
getBreadcrumbRichSnippet() | Returns the rich snippets for the route breadcrumb. | : BreadcrumbRichSnippets|null |
getCacheControl() | Returns the route cacheControl. | : CacheControl|null |
getCanonical() | Returns the route canonical. | : string |
getCountry() | Returns the route country. | : string |
getCurrency() | Returns the route currency. | : string |
getError() | Returns the current element error (if there is error). | : Error|null |
getId() | Returns the element id. | : int |
getLanguage() | Returns the route language. | : string |
getMetadata() | Returns the metadata object. | : RouteMetadata|null |
getRedirectUrl() | Returns the route redirect URL. | : string |
getStatus() | Returns the route status. | : int |
getTheme() | Returns the element theme data. | : Theme|null |
getType() | Returns the route type. | : string |
getWarning() | Returns the route warning. | : RouteWarning|null |
getWarningGeoIp() | Returns the route warningGeoIp. | : string |
jsonSerialize() | Allow elements to be serialized. | : array<string|int, mixed> |
toArray() | Used to allow elements to be serialized. | : array<string|int, mixed> |
getFieldItem() | : object|null | |
getFormattedData() | : mixed | |
setArrayField() | Convert an API array of objects to a PHP array of objects. | : array<string|int, mixed> |
setError() | : void |
Properties
$error
protected
Error|null
$error
= null
$id
Autonumeric element id.
protected
int
$id
= 0
All the given elements by the LogiCommerce API will send it.
$type
protected
string
$type
= ''
Methods
__construct()
Elements constructor.
public
__construct([array<string|int, mixed> $data = [] ]) : mixed
Parameters
- $data : array<string|int, mixed> = []
-
Array that contains all the values to the object to initialize
Return values
mixed —__toString()
Uses "json_encode" function to return the JSON format of the element.
public
__toString() : string
Auto-invoked using echo or concatenations.
Return values
string —getAlternates()
Returns the route alternates.
public
getAlternates() : array<string|int, HrefLang>
Return values
array<string|int, HrefLang> —getAvailableLanguages()
Returns the route available languages.
public
getAvailableLanguages() : array<string|int, LanguageRoute>
Return values
array<string|int, LanguageRoute> —getBreadcrumb()
Returns the route breadcrumb.
public
getBreadcrumb() : array<string|int, Breadcrumb>
Return values
array<string|int, Breadcrumb> —getBreadcrumbRichSnippet()
Returns the rich snippets for the route breadcrumb.
public
getBreadcrumbRichSnippet() : BreadcrumbRichSnippets|null
Return values
BreadcrumbRichSnippets|null —getCacheControl()
Returns the route cacheControl.
public
getCacheControl() : CacheControl|null
Return values
CacheControl|null —getCanonical()
Returns the route canonical.
public
getCanonical() : string
Return values
string —getCountry()
Returns the route country.
public
getCountry() : string
Return values
string —getCurrency()
Returns the route currency.
public
getCurrency() : string
Return values
string —getError()
Returns the current element error (if there is error).
public
getError() : Error|null
Return values
Error|null —getId()
Returns the element id.
public
getId() : int
Return values
int —getLanguage()
Returns the route language.
public
getLanguage() : string
Return values
string —getMetadata()
Returns the metadata object.
public
getMetadata() : RouteMetadata|null
Tags
Return values
RouteMetadata|null —getRedirectUrl()
Returns the route redirect URL.
public
getRedirectUrl() : string
Return values
string —getStatus()
Returns the route status.
public
getStatus() : int
Return values
int —getTheme()
Returns the element theme data.
public
getTheme() : Theme|null
Return values
Theme|null —getType()
Returns the route type.
public
getType() : string
Return values
string —getWarning()
Returns the route warning.
public
getWarning() : RouteWarning|null
Return values
RouteWarning|null —getWarningGeoIp()
Returns the route warningGeoIp.
public
getWarningGeoIp() : string
Return values
string —jsonSerialize()
Allow elements to be serialized.
public
jsonSerialize() : array<string|int, mixed>
Auto-invoked using "json_encode" function.
Return values
array<string|int, mixed> —toArray()
Used to allow elements to be serialized.
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed> —getFieldItem()
protected
getFieldItem(array<string|int, mixed> $item, string $class) : object|null
Parameters
- $item : array<string|int, mixed>
- $class : string
Return values
object|null —getFormattedData()
protected
getFormattedData(mixed $value) : mixed
Parameters
- $value : mixed
Return values
mixed —setArrayField()
Convert an API array of objects to a PHP array of objects.
protected
setArrayField(array<string|int, mixed> $data, string $class) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
-
Array that contains all the values to the objects to initialize
- $class : string
-
The PHP class we want the objects to be
Return values
array<string|int, mixed> —setError()
protected
setError(mixed $error) : void
Parameters
- $error : mixed