/**
  * The factory method is used in the parser. It may eventually be used in the facade methods as well
  * The factory should accept the name of the component as the first param and the properties as the second
  * It should also be completely case-insensitive
  */
 public function testFactoryMethod()
 {
     $component = qCal_Component::factory('VALARM', array('action' => 'audio', 'TriggER' => 'P1w3Dt2H3M45S'));
     $this->assertIsA($component, 'qCal_Component_Valarm');
 }
 /**
  * Parses any of several iCalendar formats (iCalendar, xCalendar, hCalendar) into qCal's native qCal components
  * Override doParse in a child class if necessary
  * @param array $tokens An array of arrays containing components, properties and parameters
  * @return qCal_Component_Vcalendar
  * @access protected
  */
 protected function doParse($tokens)
 {
     $properties = array();
     foreach ($tokens['properties'] as $propertytoken) {
         $params = array();
         foreach ($propertytoken['params'] as $paramtoken) {
             $params[$paramtoken['param']] = $paramtoken['value'];
         }
         try {
             $properties[] = qCal_Property::factory($propertytoken['property'], $propertytoken['value'], $params);
         } catch (qCal_Exception $e) {
             // @todo There should be a better way of determining what went wrong during parsing/lexing than this
             // do nothing...
             // pr($e);
         }
     }
     $component = qCal_Component::factory($tokens['component'], $properties);
     foreach ($tokens['children'] as $child) {
         $childcmpnt = $this->doParse($child);
         $component->attach($childcmpnt);
     }
     return $component;
 }