Methods |
public
|
__construct(Document $root, string|null $name, array $children = [], bool $defaults = true)
Creates a new component.
Creates a new component.
You can specify the children either in key=>value syntax, in which case
properties will automatically be created, or you can just pass a list of
Component and Property object.
By default, a set of sensible values will be added to the component. For
an iCalendar object, this may be something like CALSCALE:GREGORIAN. To
ensure that this does not happen, set $defaults to false.
Parameters
$name |
such as VCALENDAR, VEVENT
|
Overriden by
|
#
|
public
|
add(): Node
Adds a new property or component, and returns the new item.
Adds a new property or component, and returns the new item.
This method has 3 possible signatures:
add(Component $comp) // Adds a new component
add(Property $prop) // Adds a new property
add($name, $value, array $parameters = []) // Adds a new property
add($name, array $children = []) // Adds a new component
by name.
|
#
|
public
|
remove(string|Property|Component $item)
This method removes a component or property from this component.
This method removes a component or property from this component.
You can either specify the item by name (like DTSTART), in which case
all properties/components with that name will be removed, or you can
pass an instance of a property or component, in which case only that
exact item will be removed.
|
#
|
public
|
children(): array
Returns a flat list of all the properties and components in this
component.
Returns a flat list of all the properties and components in this
component.
|
#
|
public
|
getComponents(): array
This method only returns a list of sub-components. Properties are
ignored.
This method only returns a list of sub-components. Properties are
ignored.
|
#
|
public
|
select(string $name): array
Returns an array with elements that match the specified name.
Returns an array with elements that match the specified name.
This function is also aware of MIME-Directory groups (as they appear in
vcards). This means that if a property is grouped as "HOME.EMAIL", it
will also be returned when searching for just "EMAIL". If you want to
search for a property in a specific group, you can select on the entire
string ("HOME.EMAIL"). If you want to search on a specific property that
has not been assigned a group, specify ".EMAIL".
|
#
|
public
|
serialize(): string
Turns the object back into a serialized blob.
Turns the object back into a serialized blob.
Implements
|
#
|
public
|
jsonSerialize(): array
This method returns an array, with the representation as it should be
encoded in JSON. This is used to create jCard or…
This method returns an array, with the representation as it should be
encoded in JSON. This is used to create jCard or jCal documents.
Implements
|
#
|
public
|
xmlSerialize(Writer $writer): void
This method serializes the data into XML. This is used to create xCard or
xCal documents.
This method serializes the data into XML. This is used to create xCard or
xCal documents.
Parameters
Implements
|
#
|
public
|
__get(string $name): Property|null
Using 'get' you will either get a property or component.
Using 'get' you will either get a property or component.
If there were no child-elements found with the specified name,
null is returned.
To use this, this may look something like this:
$event = $calendar->VEVENT;
|
#
|
public
|
__isset(string $name): bool
This method checks if a sub-element with the specified name exists.
This method checks if a sub-element with the specified name exists.
|
#
|
public
|
__set(string $name, mixed $value)
Using the setter method you can add properties or subcomponents.
Using the setter method you can add properties or subcomponents.
You can either pass a Component, Property
object, or a string to automatically create a Property.
If the item already exists, it will be removed. If you want to add
a new item with the same name, always use the add() method.
|
#
|
public
|
__unset(string $name)
Removes all properties and components within this component with the
specified name.
Removes all properties and components within this component with the
specified name.
|
#
|
public
|
__clone()
This method is automatically called when the object is cloned.
Specifically, this will ensure all child elements are…
This method is automatically called when the object is cloned.
Specifically, this will ensure all child elements are also cloned.
|
#
|
public
|
getValidationRules()
A simple list of validation rules.
A simple list of validation rules.
This is simply a list of properties, and how many times they either
must or must not appear.
Possible values per property:
- 0 - Must not appear.
- 1 - Must appear exactly once.
-
-
- Must appear at least once.
-
-
- Can appear any number of times.
- ? - May appear, but not more than once.
It is also possible to specify defaults and severity levels for
violating the rule.
See the VEVENT implementation for getValidationRules for a more complex
example.
Overriden by
|
#
|
public
|
validate(int $options = 0): array
Validates the node for correctness.
Validates the node for correctness.
The following options are supported:
Node::REPAIR - May attempt to automatically repair the problem.
Node::PROFILE_CARDDAV - Validate the vCard for CardDAV purposes.
Node::PROFILE_CALDAV - Validate the iCalendar for CalDAV purposes.
This method returns an array with detected problems.
Every element has the following properties:
- level - problem level.
- message - A human-readable string describing the issue.
- node - A reference to the problematic node.
The level means:
1 - The issue was repaired (only happens if REPAIR was turned on).
2 - A warning.
3 - An error.
Overrides
Overriden by
|
#
|
public
|
destroy()
Call this method on a document if you're done using it.
Call this method on a document if you're done using it.
It's intended to remove all circular references, so PHP can easily clean
it up.
Overrides
|
#
|