Documentation

Uri extends EntityBase
in package

Represents an URI (URL or URN) as specified in RFC 3986

Tags
link
https://tools.ietf.org/html/rfc3986
todo

Add support for relative URI parsing

copyright

CLOUDREXX CMS - CLOUDREXX AG

author

Michael Ritter drissg@gmail.com

version
1.0.0
subpackage

lib_net

Table of Contents

Constants

FRAGMENT_DELIMITER  = '#'
PATH_DELIMITER_WITH_AUTHORITY  = '/'
PATH_DELIMITER_WITHOUT_AUTHORITY  = ':'
QUERY_DELIMITER  = '?'
SCHEME_DELIMITER_WITH_AUTHORITY  = '://'
SCHEME_DELIMITER_WITHOUT_AUTHORITY  = ':'
URI_REGEX  = '@^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?@'
URI_REGEX_INDEX_AUTHORITY  = 4
URI_REGEX_INDEX_FRAGMENT  = 9
URI_REGEX_INDEX_PATH  = 5
URI_REGEX_INDEX_QUERY  = 7
URI_REGEX_INDEX_SCHEME  = 2

Properties

$authority  : string
$fragment  : string
$localeCodes  : array<string|int, mixed>
List of locale codes ordered by translation fallback order per Cx instance
$nestingCount  : int
Counts the nesting level of __call()
$path  : array<string|int, mixed>
$pathDelimiter  : string
$query  : string
$scheme  : string
$stringRepresentationBlank  : bool
Whether blank string representations are valid
$stringRepresentationFields  : array<string|int, mixed>
List of fields that should be available in the string representation
$stringRepresentationFormat  : string
Sprintf format for the string representation
$validators  : array<string|int, mixed>
Initialize this array as follows: array( 'columName' => Zend_Validate )
$virtual  : bool
Defines if an entity is virtual and therefore not persistable.

Methods

__call()  : mixed
Route methods like getName(), getType(), getDirectory(), etc.
__construct()  : mixed
Creates a new Uri instance
__get()  : mixed
This is an ugly solution to allow $this->cx to be available in all entity classes Since the entity's constructor is not called when an entity is loaded from DB this cannot be assigned there.
__toString()  : string
Returns Uri as string
getAuthority()  : string
Returns the current authority section
getComponentController()  : SystemComponent
Returns the component controller for this component
getFragment()  : string
Returns the current fragment section
getKeyAsString()  : string
Returns this entity's key
getPath()  : string
Returns the current path section
getPathDelimiter()  : string
Returns the current path delimiter
getPathParts()  : array<string|int, mixed>
Returns the current path section split by path delimiter
getQuery()  : string
Returns the current query section
getScheme()  : string
Returns the current scheme
getTranslatedFieldValue()  : mixed
Returns the value of a translatable field using fallback mechanisms
hasAuthority()  : bool
Tells wheter this Uri has an authority section
hasFragment()  : bool
Tells wheter this Uri has a fragment section
hasQuery()  : bool
Tells wheter this Uri has a query section
initializeValidators()  : mixed
Set $this->validators
isVirtual()  : bool
Returns the virtuality of the entity
setAuthority()  : mixed
Sets the current authority
setFragment()  : mixed
Sets the current fragment
setPath()  : mixed
Sets the current path
setPathDelimiter()  : mixed
Sets the current path delimiter
setQuery()  : mixed
Sets the current query
setScheme()  : mixed
Sets the current scheme
setVirtual()  : mixed
Set the virtuality of the entity
toString()  : string
Returns the string representation for this URI
validate()  : mixed
getFallbackLocaleCodes()  : array<string|int, mixed>
Returns a list of all locale codes ordered by fallback order
getStringRepresentationBlank()  : bool
Whether blank string representations are valid
getStringRepresentationFields()  : array<string|int, mixed>
Returns a list of fields available in the string representation
getStringRepresentationFormat()  : string
Returns the sprintf() format for the string representation

Constants

FRAGMENT_DELIMITER

public string FRAGMENT_DELIMITER = '#'

Delimiter for fragment section

PATH_DELIMITER_WITH_AUTHORITY

public string PATH_DELIMITER_WITH_AUTHORITY = '/'

Delimiter for path parts if there's an authority section

PATH_DELIMITER_WITHOUT_AUTHORITY

public string PATH_DELIMITER_WITHOUT_AUTHORITY = ':'

Delimiter for path parts if there's no authority section

QUERY_DELIMITER

public string QUERY_DELIMITER = '?'

Delimiter for query section

SCHEME_DELIMITER_WITH_AUTHORITY

public string SCHEME_DELIMITER_WITH_AUTHORITY = '://'

Delimiter for scheme if there's an authority section

SCHEME_DELIMITER_WITHOUT_AUTHORITY

public string SCHEME_DELIMITER_WITHOUT_AUTHORITY = ':'

Delimiter for scheme if there's no authority section

URI_REGEX

public string URI_REGEX = '@^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?@'

Regular expression to split URIs from https://tools.ietf.org/html/rfc3986#page-50

URI_REGEX_INDEX_AUTHORITY

public int URI_REGEX_INDEX_AUTHORITY = 4

Index of the above REGEX for authority part

URI_REGEX_INDEX_FRAGMENT

public int URI_REGEX_INDEX_FRAGMENT = 9

Index of the above REGEX for fragment part

URI_REGEX_INDEX_PATH

public int URI_REGEX_INDEX_PATH = 5

Index of the above REGEX for path part

URI_REGEX_INDEX_QUERY

public int URI_REGEX_INDEX_QUERY = 7

Index of the above REGEX for query part

URI_REGEX_INDEX_SCHEME

public int URI_REGEX_INDEX_SCHEME = 2

Index of the above REGEX for scheme part

Properties

$authority

protected string $authority

Authority part

$fragment

protected string $fragment = ''

Fragment part

$localeCodes

List of locale codes ordered by translation fallback order per Cx instance

protected static array<string|int, mixed> $localeCodes = array()

Array in the form: array(<instanceId> => array(<localeCode>, ...))

Tags
see
getFallbackLocaleCodes()

$nestingCount

Counts the nesting level of __call()

protected static int $nestingCount = 0

$path

protected array<string|int, mixed> $path

Path parts

$pathDelimiter

protected string $pathDelimiter

Currently used delimitier to separate path sub-parts

$query

protected string $query = ''

Query part

$scheme

protected string $scheme

Scheme part

$stringRepresentationBlank

Whether blank string representations are valid

protected bool $stringRepresentationBlank = false

Whether blank string representations are valid

Tags
see
getStringRepresentationBlank()

$stringRepresentationFields

List of fields that should be available in the string representation

protected array<string|int, mixed> $stringRepresentationFields = array()

List of field names

Tags
see
getStringRepresentationFields()

$stringRepresentationFormat

Sprintf format for the string representation

protected string $stringRepresentationFormat = ''

Sprintf format string

Tags
see
getStringRepresentationFormat()

$validators

Initialize this array as follows: array( 'columName' => Zend_Validate )

protected array<string|int, mixed> $validators = array()

$virtual

Defines if an entity is virtual and therefore not persistable.

protected bool $virtual = false

Defaults to FALSE - not virtual.

Methods

__call()

Route methods like getName(), getType(), getDirectory(), etc.

public __call(string $methodName, array<string|int, mixed> $arguments) : mixed
Parameters
$methodName : string

Name of method to call

$arguments : array<string|int, mixed>

List of arguments for the method to call

Tags
throws
Exception

If __call() nesting level reaches 20

Attributes
#[ReturnTypeWillChange]
Return values
mixed

Return value of the method to call

__construct()

Creates a new Uri instance

public __construct(string $stringUri) : mixed
Parameters
$stringUri : string

URI as string

__get()

This is an ugly solution to allow $this->cx to be available in all entity classes Since the entity's constructor is not called when an entity is loaded from DB this cannot be assigned there.

public __get(mixed $name) : mixed
Parameters
$name : mixed
Attributes
#[ReturnTypeWillChange]

__toString()

Returns Uri as string

public __toString() : string
Return values
string

Uri as string

getAuthority()

Returns the current authority section

public getAuthority() : string
Return values
string

Authority section

getFragment()

Returns the current fragment section

public getFragment() : string
Return values
string

Fragment section

getKeyAsString()

Returns this entity's key

public final getKeyAsString([string $separator = '/' ]) : string

If this entity has a composite key, the fields are separated by $separator.

Parameters
$separator : string = '/'

(optional) Separator for composite key fields, default "/"

Return values
string

Entity key as string

getPath()

Returns the current path section

public getPath() : string
Return values
string

Path section

getPathDelimiter()

Returns the current path delimiter

public getPathDelimiter() : string
Return values
string

Path delimiter

getPathParts()

Returns the current path section split by path delimiter

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

Path section

getQuery()

Returns the current query section

public getQuery() : string
Return values
string

Query section

getScheme()

Returns the current scheme

public getScheme() : string
Return values
string

Scheme

getTranslatedFieldValue()

Returns the value of a translatable field using fallback mechanisms

public getTranslatedFieldValue(string $fieldName) : mixed

If the field is not translatable its value is returned anyway. Tries to return the value in the following locales (if non-empty):

  • Current locale
  • Default locale
  • All other locales
Parameters
$fieldName : string

Name of a translatable field

hasAuthority()

Tells wheter this Uri has an authority section

public hasAuthority() : bool
Return values
bool

True if there's an authority section, false otherwise

hasFragment()

Tells wheter this Uri has a fragment section

public hasFragment() : bool
Return values
bool

True if there's a fragment section, false otherwise

hasQuery()

Tells wheter this Uri has a query section

public hasQuery() : bool
Return values
bool

True if there's a query section, false otherwise

initializeValidators()

Set $this->validators

public initializeValidators() : mixed

Validators can be found in lib/FRAMEWORK/Validator.class.php These will be executed if validate() is called

isVirtual()

Returns the virtuality of the entity

public isVirtual() : bool
Return values
bool

TRUE if the entity is virtual, otherwise FALSE

setAuthority()

Sets the current authority

public setAuthority(string $authority) : mixed
Parameters
$authority : string

New authority

setFragment()

Sets the current fragment

public setFragment(string $fragment) : mixed
Parameters
$fragment : string

New fragment

setPath()

Sets the current path

public setPath(string $path) : mixed
Parameters
$path : string

New path

setPathDelimiter()

Sets the current path delimiter

public setPathDelimiter(string $pathDelimiter) : mixed
Parameters
$pathDelimiter : string

New path delimiter

setQuery()

Sets the current query

public setQuery(string $query) : mixed
Parameters
$query : string

New query

setScheme()

Sets the current scheme

public setScheme(string $scheme) : mixed
Parameters
$scheme : string

New scheme

setVirtual()

Set the virtuality of the entity

public setVirtual(bool $virtual) : mixed
Parameters
$virtual : bool

TRUE to set the entity as virtual or otherwise to FALSE

toString()

Returns the string representation for this URI

public toString() : string
Tags
see
__toString()
todo

implement a (descendant) method for relative URI/Ls

Return values
string

String representation for this URI

getFallbackLocaleCodes()

Returns a list of all locale codes ordered by fallback order

protected getFallbackLocaleCodes() : array<string|int, mixed>
  • First entry is the current locale
  • Second entry is the default locale (if different from current, it's omitted otherwise)
  • Then all other locales follow (in no particular order)
Tags
todo

Order the array by the fallback order (same as in ContentManager)

Return values
array<string|int, mixed>

List of locale codes

getStringRepresentationBlank()

Whether blank string representations are valid

protected getStringRepresentationBlank() : bool
Return values
bool

Whether blank string representations are valid

getStringRepresentationFields()

Returns a list of fields available in the string representation

protected getStringRepresentationFields() : array<string|int, mixed>
Return values
array<string|int, mixed>

List of field names

getStringRepresentationFormat()

Returns the sprintf() format for the string representation

protected getStringRepresentationFormat() : string
Return values
string

sprintf() format string


        
On this page

Search results