public function parse($input = null, $options = 0)
    {
        if (!is_null($input)) {
            $this->setInput($input);
        }

        if (0 !== $options) {
            $this->options = $options;
        }

        if (is_null($this->input)) {
            throw new EofException('End of input stream, or no input supplied');
        }

        switch ($this->input['name']) {
            case '{'.self::XCAL_NAMESPACE.'}icalendar':
                $this->root = new VCalendar([], false);
                $this->pointer = &$this->input['value'][0];
                $this->parseVCalendarComponents($this->root);
                break;

            case '{'.self::XCARD_NAMESPACE.'}vcards':
                foreach ($this->input['value'] as &$vCard) {
                    $this->root = new VCard(['version' => '4.0'], false);
                    $this->pointer = &$vCard;
                    $this->parseVCardComponents($this->root);

                    // We just parse the first <vcard /> element.
                    break;
                }
                break;

            default:
                throw new ParseException('Unsupported XML standard');
        }

        return $this->root;
    }
public function parse($input = null, $options = 0)
    {
        if (!is_null($input)) {
            $this->setInput($input);
        }

        if (0 !== $options) {
            $this->options = $options;
        }

        if (is_null($this->input)) {
            throw new EofException('End of input stream, or no input supplied');
        }

        switch ($this->input['name']) {
            case '{'.self::XCAL_NAMESPACE.'}icalendar':
                $this->root = new VCalendar([], false);
                $this->pointer = &$this->input['value'][0];
                $this->parseVCalendarComponents($this->root);
                break;

            case '{'.self::XCARD_NAMESPACE.'}vcards':
                foreach ($this->input['value'] as &$vCard) {
                    $this->root = new VCard(['version' => '4.0'], false);
                    $this->pointer = &$vCard;
                    $this->parseVCardComponents($this->root);

                    // We just parse the first <vcard /> element.
                    break;
                }
                break;

            default:
                throw new ParseException('Unsupported XML standard');
        }

        return $this->root;
    }
public function parse ( $ input = null , $ options = 0 ) { if ( ! is_null ( $ input ) ) { $ this -> setInput ( $ input ) ; } if ( 0 !== $ options ) { $ this -> options = $ options ; } if ( is_null ( $ this -> input ) ) { throw new EofException ( 'End of input stream, or no input supplied' ) ; } switch ( $ this -> input [ 'name' ] ) { case '{' . self :: XCAL_NAMESPACE . '}icalendar' : $ this -> root = new VCalendar ( [ ] , false ) ; $ this -> pointer = & $ this -> input [ 'value' ] [ 0 ] ; $ this -> parseVCalendarComponents ( $ this -> root ) ; break ; case '{' . self :: XCARD_NAMESPACE . '}vcards' : foreach ( $ this -> input [ 'value' ] as & $ vCard ) { $ this -> root = new VCard ( [ 'version' => '4.0' ] , false ) ; $ this -> pointer = & $ vCard ; $ this -> parseVCardComponents ( $ this -> root ) ; // We just parse the first <vcard /> element. break ; } break ; default : throw new ParseException ( 'Unsupported XML standard' ) ; } return $ this -> root ; }
Parse xCal or xCard.

@param resource|string $input
@param int             $options

@throws \Exception

@return \Sabre\VObject\Document
Parse xCal or xCard .