87        if (is_null($this->
input)) {
 
   88            throw new EofException(
'End of input stream, or no input supplied');
 
   91        switch ($this->
input[
'name']) {
 
   93            case '{' . self::XCAL_NAMESPACE . 
'}icalendar':
 
   95                $this->pointer = &$this->
input[
'value'][0];
 
   99            case '{' . self::XCARD_NAMESPACE . 
'}vcards':
 
  100                foreach ($this->
input[
'value'] as &$vCard) {
 
  102                    $this->root = 
new VCard([
'version' => 
'4.0'], 
false);
 
  103                    $this->pointer = &$vCard;
 
  129        foreach ($this->pointer[
'value'] ?: [] as $children) {
 
  131            switch (static::getTagName($children[
'name'])) {
 
  134                    $this->pointer = &$children[
'value'];
 
  139                    $this->pointer = &$children;
 
  156        $this->pointer = &$this->pointer[
'value'];
 
  171        foreach ($this->pointer ?: [] as $xmlProperty) {
 
  175            $propertyName = $tagName;
 
  177            $propertyParameters = [];
 
  178            $propertyType = 
'text';
 
  184                $propertyName = 
'xml';
 
  185                $value = 
'<' . $tagName . 
' xmlns="' . 
$namespace . 
'"';
 
  187                foreach ($xmlProperty[
'attributes'] as $attributeName => $attributeValue) {
 
  188                    $value .= 
' ' . $attributeName . 
'="' . str_replace(
'"', 
'\"', $attributeValue) . 
'"';
 
  191                $value .= 
'>' . $xmlProperty[
'value'] . 
'</' . $tagName . 
'>';
 
  193                $propertyValue = [$value];
 
  207            if ($propertyName === 
'group') {
 
  209                if (!isset($xmlProperty[
'attributes'][
'name'])) {
 
  213                $this->pointer = &$xmlProperty[
'value'];
 
  216                    strtoupper($xmlProperty[
'attributes'][
'name']) . 
'.' 
  224            foreach ($xmlProperty[
'value'] as 
$i => $xmlPropertyChild) {
 
  226                if (!is_array($xmlPropertyChild)
 
  227                    || 
'parameters' !== static::getTagName($xmlPropertyChild[
'name']))
 
  230                $xmlParameters = $xmlPropertyChild[
'value'];
 
  232                foreach ($xmlParameters as $xmlParameter) {
 
  234                    $propertyParameterValues = [];
 
  236                    foreach ($xmlParameter[
'value'] as $xmlParameterValues) {
 
  237                        $propertyParameterValues[] = $xmlParameterValues[
'value'];
 
  240                    $propertyParameters[static::getTagName($xmlParameter[
'name'])]
 
  241                        = implode(
',', $propertyParameterValues);
 
  245                array_splice($xmlProperty[
'value'], 
$i, 1);
 
  249            $propertyNameExtended = ($this->root instanceof 
VCalendar 
  251                                      : 
'xcard') . 
':' . $propertyName;
 
  253            switch ($propertyNameExtended) {
 
  256                    $propertyType = 
'float';
 
  257                    $propertyValue[
'latitude'] = 0;
 
  258                    $propertyValue[
'longitude'] = 0;
 
  260                    foreach ($xmlProperty[
'value'] as $xmlRequestChild) {
 
  261                        $propertyValue[static::getTagName($xmlRequestChild[
'name'])]
 
  262                            = $xmlRequestChild[
'value'];
 
  266                case 'xcal:request-status':
 
  267                    $propertyType = 
'text';
 
  269                    foreach ($xmlProperty[
'value'] as $xmlRequestChild) {
 
  270                        $propertyValue[static::getTagName($xmlRequestChild[
'name'])]
 
  271                            = $xmlRequestChild[
'value'];
 
  275                case 'xcal:freebusy':
 
  276                    $propertyType = 
'freebusy';
 
  280                case 'xcal:categories':
 
  281                case 'xcal:resources':
 
  283                    foreach ($xmlProperty[
'value'] as $specialChild) {
 
  284                        $propertyValue[static::getTagName($specialChild[
'name'])]
 
  285                            = $specialChild[
'value'];
 
  290                    $propertyType = 
'date-time';
 
  292                    foreach ($xmlProperty[
'value'] as $specialChild) {
 
  294                        $tagName = static::getTagName($specialChild[
'name']);
 
  296                        if (
'period' === $tagName) {
 
  298                            $propertyParameters[
'value'] = 
'PERIOD';
 
  299                            $propertyValue[] = implode(
'/', $specialChild[
'value']);
 
  303                            $propertyValue[] = $specialChild[
'value'];
 
  309                    $propertyType = static::getTagName($xmlProperty[
'value'][0][
'name']);
 
  311                    foreach ($xmlProperty[
'value'] as $value) {
 
  312                        $propertyValue[] = $value[
'value'];
 
  315                    if (
'date' === $propertyType) {
 
  316                        $propertyParameters[
'value'] = 
'DATE';
 
  323                $propertyNamePrefix . $propertyName,
 
  342        $components = $this->pointer[
'value'] ?: [];
 
  344        foreach ($components as $component) {
 
  346            $componentName = static::getTagName($component[
'name']);
 
  347            $currentComponent = $this->root->createComponent(
 
  353            $this->pointer = &$component;
 
  356            $parentComponent->
add($currentComponent);
 
  375        $property = $this->root->createProperty(
 
  381        $parentComponent->
add($property);
 
  382        $property->setXmlValue($value);
 
  395        if (is_resource(
$input)) {
 
  402            $reader->elementMap[
'{' . self::XCAL_NAMESPACE . 
'}period']
 
  403                = 
'Sabre\VObject\Parser\XML\Element\KeyValue';
 
  404            $reader->elementMap[
'{' . self::XCAL_NAMESPACE . 
'}recur']
 
  405                = 
'Sabre\VObject\Parser\XML\Element\KeyValue';
 
An exception for terminatinating execution or to throw for unit testing.
add()
Adds a new property or component, and returns the new item.
Exception thrown by parser when the end of the stream has been reached, before this was expected.
Exception thrown by Reader if an invalid object was attempted to be parsed.
parseComponent(Component $parentComponent)
Parse a component.
createProperty(Component $parentComponent, $name, $parameters, $type, $value)
Create a property.
setInput($input)
Sets the input data.
static getTagName($clarkedTagName)
Get tag name from a Clark notation.
parse($input=null, $options=0)
Parse xCal or xCard.
parseVCalendarComponents(Component $parentComponent)
Parse a xCalendar component.
parseVCardComponents(Component $parentComponent)
Parse a xCard component.
__construct($input=null, $options=0)
Creates the parser.
parseProperties(Component $parentComponent, $propertyNamePrefix='')
Parse xCalendar and xCard properties.
The Reader class expands upon PHP's built-in XMLReader.
static parseClarkNotation($str)
Parses a clark-notation string, and returns the namespace and element name components.
if($err=$client->getError()) $namespace