Class PhpiCalLib_Component

Description

An iCalendar Component

Located in /components.php (line 54)


	
			
Direct descendents
Class Description
PhpiCalLib_Event An eventc iCalendar component
PhpiCalLib_iCalendar The top level class of PhpiCalLib, representing the contents of an iCalendar file
Variable Summary
string $Name
integer $Type
Method Summary
static int ToComponentType (string $Name)
PhpiCalLib_Component __construct ()
void AddProperty (PhpiCalLib_ContentLine $ContentLine)
A Create (string $Name, string $aProperties)
returns GetName ()
array GetProperties ([integer $Type = null], [string $Name = null])
A GetProperty (integer $Type, [string $Name = null])
PHPICALLIB_COMPONENTS_* GetType ()
void RemoveProperty (integer $Type, [string $Name = null])
void RemovePropertyPermitted (integer $Type, string $Name)
void SetName (string $Name)
void SetProperties (PhpiCalLib_ContentLines $aContentLines)
void SetProperty (PhpiCalLib_ContentLine $ContentLine)
void SetType (integer $Type)
An ToString ()
Variables
array $aContentLines = array() (line 66)
  • var: The content lines of this component
  • access: protected
array $aPermittedProperties = array() (line 128)

Info about which properties are permitted for this component

Empty array means all properties are permitted. Each entry is keyed by id. The values indicate the min and max number of instances. For example, the spec says this for VALARM. http://tools.ietf.org/html/draft-ietf-calsify-rfc2445bis-08#section-3.6.6

        audioprop  = *(
                   ; 'action' and 'trigger' are both REQUIRED,
                   ; but MUST NOT occur more than once
                   action / trigger /

                   ; 'duration' and 'repeat' are both OPTIONAL,
                   ; and MUST NOT occur more than once each,
                   ; but if one occurs, so MUST the other
                   duration / repeat /

                   ; the following is OPTIONAL,
                   ; but MUST NOT occur more than once
                   attach /

                   ; the following is OPTIONAL,
                   ; and MAY occur more than once
                   x-prop / iana-prop
                   )

This would be implemented as:

  1.  $this->aPermittedProperties array(
  2.                 //                   ; 'action' and 'trigger' are both REQUIRED,
  3.                 //                   ; but MUST NOT occur more than once
  4.                 //                   action / trigger /
  5.                 PHPICALLIB_PROPERTY_ACTION => array(1,1),
  6.                 PHPICALLIB_PROPERTY_TRIGGER => array(1,1),
  7.                 //                   ; 'duration' and 'repeat' are both OPTIONAL,
  8.                 //                   ; and MUST NOT occur more than once each,
  9.                 //                   ; but if one occurs, so MUST the other
  10.                 //                   duration / repeat /
  11.                 PHPICALLIB_PROPERTY_DURATION => array(0,1),
  12.                 PHPICALLIB_PROPERTY_ => array(0,1),
  13.                 //                   ; the following is OPTIONAL,
  14.                 //                   ; but MUST NOT occur more than once
  15.                 //                   attach /
  16.                 PHPICALLIB_PROPERTY_ATTACH => array(0,1),
  17.                 //                   ; the following is OPTIONAL,
  18.                 //                   ; and MAY occur more than once
  19.                 //                   x-prop / iana-prop
  20.                 PHPICALLIB_PROPERTY_XPROP => array(0,-1),
  21.                 PHPICALLIB_PROPERTY_IANAPROP => array(0,-1));

Note that this mechanism isn't sufficient to ensure the component only has valid properties, for example two properties may be mutually exclusive. Where that is the case the user should override (@link AddPropertyPermitted()}, RemovePropertyPermitted or SetPropertyPermitted to make sure that any remaining rules have been followed.

  • var: Keyed by PHPICALLIB_PROPERTY_* ids, value is an array(mininstances, maxinstances)
  • access: protected
string $Name = '' (line 58)
  • var: The name of this component
  • access: protected
integer $Type = 0 (line 62)
  • var: The type of this component
  • access: protected
Methods
static method ToComponentType (line 158)

Convert a component name to it's defined type

  • return: one of the PHPICALLIB_COMPONENT_* properties
  • access: public
static int ToComponentType (string $Name)
  • string $Name: a "name" RFC2445 token
Constructor __construct (line 149)

Constructor

  • access: public
PhpiCalLib_Component __construct ()

Redefined in descendants as:
AddProperty (line 381)

Add the property to the component

  • access: public
void AddProperty (PhpiCalLib_ContentLine $ContentLine)
AddPropertyPermitted (line 482)

Determine if the given property is permitted for addition

  • access: protected
void AddPropertyPermitted (PhpiCalLib_ContentLine $ContentLine)

Redefined in descendants as:
Create (line 451)

Create a component object from it's name and it's properties, returning the new object

  • return: PhpiCalLib_Component derived class, according to what CreateComponent returned
  • access: public
A Create (string $Name, string $aProperties)
  • string $Name: The name of the component to create
  • string $aProperties: An array of the properties of this component
CreateComponent (line 438)

Create a new Component object

A component would override this class, providing a new version of this function in order to choose the right kind of class to create.

  • return: derived class
  • access: protected
PhpiCalLib_Component CreateComponent (string $Name)
  • string $Name: The name of the component

Redefined in descendants as:
GetName (line 179)

Obtain the name of the component

  • return: the name of the component
  • access: public
returns GetName ()
GetProperties (line 260)

Get all the properties of the given type/name

  • return: of matching PhpiCalLib_ContentLine objects, empty array of no content lines matched
  • access: public
array GetProperties ([integer $Type = null], [string $Name = null])
  • integer $Type: The type of the property to return. Null means return all properties
  • string $Name: The name of the property, necessary if $Type is PHPICALLIB_PROPERTY_XPROP or PHPICALLIB_PROPERTY_IANAPROP. If null, all properties of these types will be returned.
GetProperty (line 303)

Get a single property of the given type/name

  • return: single PhpiCalLib_ContentLine derived object, or null if no propety of the given type was found.
  • access: public
A GetProperty (integer $Type, [string $Name = null])
  • integer $Type: The type of the property to return. Null means return all properties
  • string $Name: The name of the property, necessary if $Type is PHPICALLIB_PROPERTY_XPROP or PHPICALLIB_PROPERTY_IANAPROP. If null, all properties of these types will be returned.
GetType (line 229)

Access the component type

Note this will return PHPICALLIB_COMPONENT_IANACOMP or PHPICALLIB_COMPONENT_XCOMP for components that it doesn't recognize

  • access: public
PHPICALLIB_COMPONENTS_* GetType ()
RemoveProperty (line 395)

Delete all the properties of the given type

  • access: public
void RemoveProperty (integer $Type, [string $Name = null])
  • integer $Type: The PHPICALLIB_PROPERTY_? type of the property
  • string $Name: The name of the property, used when $Type = PHPICALLIB_PROPERTY_XPROP or PHPICALLIB_PROPERTY_IANAPROP. If empty all properties of either type will be deleted
RemovePropertyPermitted (line 527)

Determine if we are allowed to remove the given property

  • access: protected
void RemovePropertyPermitted (integer $Type, string $Name)
  • integer $Type
  • string $Name
SetName (line 191)

Set the new name for the property

  • access: public
void SetName (string $Name)
  • string $Name
SetProperties (line 333)

Set the content lines for the component, replacing any existing properties

  • access: public
void SetProperties (PhpiCalLib_ContentLines $aContentLines)
  • PhpiCalLib_ContentLines $aContentLines
SetProperty (line 366)

Sets a property, replacing any existing values of the same type

  • access: public
void SetProperty (PhpiCalLib_ContentLine $ContentLine)
SetPropertyPermitted (line 463)

Determine if the given property can be changed

  • access: protected
void SetPropertyPermitted (PhpiCalLib_ContentLine $ContentLine)

Redefined in descendants as:
SetType (line 238)

Set the type of the component

  • access: public
void SetType (integer $Type)
  • integer $Type
ToString (line 563)

Dump the parameter to an array of unfolded content lines

  • return: string array representation in the default code page
  • access: public
An ToString ()

Redefined in descendants as:

Documentation generated on Tue, 01 Apr 2008 00:20:00 +0100 by phpDocumentor 1.4.0