Principal
extends Href
in package
Principal property.
The principal property represents a principal from RFC3744 (ACL). The property can be used to specify a principal or pseudo principals.
Tags
Table of Contents
- ALL = 4
- Everybody, basically.
- AUTHENTICATED = 2
- To specify any principal that is logged in, use AUTHENTICATED.
- HREF = 3
- Specific principals can be specified with the HREF.
- UNAUTHENTICATED = 1
- To specify a not-logged-in user, use the UNAUTHENTICATED principal.
- $hrefs : array<string|int, mixed>
- List of uris.
- $type : int
- Principal-type.
- __construct() : mixed
- Creates the property.
- getHref() : string|null
- Returns the first Href.
- getHrefs() : array<string|int, mixed>
- Returns the hrefs as an array.
- getType() : int
- Returns the principal type.
- toHtml() : string
- Generate html representation for this value.
- xmlDeserialize() : mixed
- The deserialize method is called during xml parsing.
- xmlSerialize() : mixed
- The xmlSerialize method is called during xml writing.
Constants
ALL
Everybody, basically.
public
mixed
ALL
= 4
AUTHENTICATED
To specify any principal that is logged in, use AUTHENTICATED.
public
mixed
AUTHENTICATED
= 2
HREF
Specific principals can be specified with the HREF.
public
mixed
HREF
= 3
UNAUTHENTICATED
To specify a not-logged-in user, use the UNAUTHENTICATED principal.
public
mixed
UNAUTHENTICATED
= 1
Properties
$hrefs
List of uris.
protected
array<string|int, mixed>
$hrefs
$type
Principal-type.
protected
int
$type
Must be one of the UNAUTHENTICATED, AUTHENTICATED or HREF constants.
Methods
__construct()
Creates the property.
public
__construct(int $type[, string|null $href = null ]) : mixed
The 'type' argument must be one of the type constants defined in this class.
'href' is only required for the HREF type.
Parameters
- $type : int
- $href : string|null = null
Return values
mixed —getHref()
Returns the first Href.
public
getHref() : string|null
Return values
string|null —getHrefs()
Returns the hrefs as an array.
public
getHrefs() : array<string|int, mixed>
Return values
array<string|int, mixed> —getType()
Returns the principal type.
public
getType() : int
Return values
int —toHtml()
Generate html representation for this value.
public
toHtml(HtmlOutputHelper $html) : string
The html output is 100% trusted, and no effort is being made to sanitize it. It's up to the implementor to sanitize user provided values.
The output must be in UTF-8.
The baseUri parameter is a url to the root of the application, and can be used to construct local links.
Parameters
- $html : HtmlOutputHelper
Return values
string —xmlDeserialize()
The deserialize method is called during xml parsing.
public
static xmlDeserialize(Reader $reader) : mixed
This method is called staticly, this is because in theory this method may be used as a type of constructor, or factory method.
Often you want to return an instance of the current class, but you are free to return other data as well.
Important note 2: You are responsible for advancing the reader to the next element. Not doing anything will result in a never-ending loop.
If you just want to skip parsing for this element altogether, you can just call $reader->next();
$reader->parseInnerTree() will parse the entire sub-tree, and advance to the next element.
Parameters
- $reader : Reader
Return values
mixed —xmlSerialize()
The xmlSerialize method is called during xml writing.
public
xmlSerialize(Writer $writer) : mixed
Use the $writer argument to write its own xml serialization.
An important note: do not create a parent element. Any element implementing XmlSerializable should only ever write what's considered its 'inner xml'.
The parent of the current element is responsible for writing a containing element.
This allows serializers to be re-used for different element names.
If you are opening new elements, you must also close them again.
Parameters
- $writer : Writer