public function getResult()
    {
        $calendar = new VCalendar();

        foreach ($this->objects as $object) {
            // Skip if there is no BDAY property.
            if (!$object->select('BDAY')) {
                continue;
            }

            // We've seen clients (ez-vcard) putting "BDAY:" properties
            // without a value into vCards. If we come across those, we'll
            // skip them.
            if (empty($object->BDAY->getValue())) {
                continue;
            }

            // We're always converting to vCard 4.0 so we can rely on the
            // VCardConverter handling the X-APPLE-OMIT-YEAR property for us.
            $object = $object->convert(Document::VCARD40);

            // Skip if the card has no FN property.
            if (!isset($object->FN)) {
                continue;
            }

            // Skip if the BDAY property is not of the right type.
            if (!$object->BDAY instanceof Property\VCard\DateAndOrTime) {
                continue;
            }

            // Skip if we can't parse the BDAY value.
            try {
                $dateParts = DateTimeParser::parseVCardDateTime($object->BDAY->getValue());
            } catch (InvalidDataException $e) {
                continue;
            }

            // Set a year if it's not set.
            $unknownYear = false;

            if (!$dateParts['year']) {
                $object->BDAY = self::DEFAULT_YEAR.'-'.$dateParts['month'].'-'.$dateParts['date'];

                $unknownYear = true;
            }

            // Create event.
            $event = $calendar->add('VEVENT', [
                'SUMMARY' => sprintf($this->format, $object->FN->getValue()),
                'DTSTART' => new \DateTime($object->BDAY->getValue()),
                'RRULE' => 'FREQ=YEARLY',
                'TRANSP' => 'TRANSPARENT',
            ]);

            // add VALUE=date
            $event->DTSTART['VALUE'] = 'DATE';

            // Add X-SABRE-BDAY property.
            if ($unknownYear) {
                $event->add('X-SABRE-BDAY', 'BDAY', [
                    'X-SABRE-VCARD-UID' => $object->UID->getValue(),
                    'X-SABRE-VCARD-FN' => $object->FN->getValue(),
                    'X-SABRE-OMIT-YEAR' => self::DEFAULT_YEAR,
                ]);
            } else {
                $event->add('X-SABRE-BDAY', 'BDAY', [
                    'X-SABRE-VCARD-UID' => $object->UID->getValue(),
                    'X-SABRE-VCARD-FN' => $object->FN->getValue(),
                ]);
            }
        }

        return $calendar;
    }
public function getResult()
    {
        $calendar = new VCalendar();

        foreach ($this->objects as $object) {
            // Skip if there is no BDAY property.
            if (!$object->select('BDAY')) {
                continue;
            }

            // We've seen clients (ez-vcard) putting "BDAY:" properties
            // without a value into vCards. If we come across those, we'll
            // skip them.
            if (empty($object->BDAY->getValue())) {
                continue;
            }

            // We're always converting to vCard 4.0 so we can rely on the
            // VCardConverter handling the X-APPLE-OMIT-YEAR property for us.
            $object = $object->convert(Document::VCARD40);

            // Skip if the card has no FN property.
            if (!isset($object->FN)) {
                continue;
            }

            // Skip if the BDAY property is not of the right type.
            if (!$object->BDAY instanceof Property\VCard\DateAndOrTime) {
                continue;
            }

            // Skip if we can't parse the BDAY value.
            try {
                $dateParts = DateTimeParser::parseVCardDateTime($object->BDAY->getValue());
            } catch (InvalidDataException $e) {
                continue;
            }

            // Set a year if it's not set.
            $unknownYear = false;

            if (!$dateParts['year']) {
                $object->BDAY = self::DEFAULT_YEAR.'-'.$dateParts['month'].'-'.$dateParts['date'];

                $unknownYear = true;
            }

            // Create event.
            $event = $calendar->add('VEVENT', [
                'SUMMARY' => sprintf($this->format, $object->FN->getValue()),
                'DTSTART' => new \DateTime($object->BDAY->getValue()),
                'RRULE' => 'FREQ=YEARLY',
                'TRANSP' => 'TRANSPARENT',
            ]);

            // add VALUE=date
            $event->DTSTART['VALUE'] = 'DATE';

            // Add X-SABRE-BDAY property.
            if ($unknownYear) {
                $event->add('X-SABRE-BDAY', 'BDAY', [
                    'X-SABRE-VCARD-UID' => $object->UID->getValue(),
                    'X-SABRE-VCARD-FN' => $object->FN->getValue(),
                    'X-SABRE-OMIT-YEAR' => self::DEFAULT_YEAR,
                ]);
            } else {
                $event->add('X-SABRE-BDAY', 'BDAY', [
                    'X-SABRE-VCARD-UID' => $object->UID->getValue(),
                    'X-SABRE-VCARD-FN' => $object->FN->getValue(),
                ]);
            }
        }

        return $calendar;
    }
public function getResult ( ) { $ calendar = new VCalendar ( ) ; foreach ( $ this -> objects as $ object ) { // Skip if there is no BDAY property. if ( ! $ object -> select ( 'BDAY' ) ) { continue ; } // We've seen clients (ez-vcard) putting "BDAY:" properties // without a value into vCards. If we come across those, we'll // skip them. if ( empty ( $ object -> BDAY -> getValue ( ) ) ) { continue ; } // We're always converting to vCard 4.0 so we can rely on the // VCardConverter handling the X-APPLE-OMIT-YEAR property for us. $ object = $ object -> convert ( Document :: VCARD40 ) ; // Skip if the card has no FN property. if ( ! isset ( $ object -> FN ) ) { continue ; } // Skip if the BDAY property is not of the right type. if ( ! $ object -> BDAY instanceof Property \ VCard \ DateAndOrTime ) { continue ; } // Skip if we can't parse the BDAY value. try { $ dateParts = DateTimeParser :: parseVCardDateTime ( $ object -> BDAY -> getValue ( ) ) ; } catch ( InvalidDataException $ e ) { continue ; } // Set a year if it's not set. $ unknownYear = false ; if ( ! $ dateParts [ 'year' ] ) { $ object -> BDAY = self :: DEFAULT_YEAR . '-' . $ dateParts [ 'month' ] . '-' . $ dateParts [ 'date' ] ; $ unknownYear = true ; } // Create event. $ event = $ calendar -> add ( 'VEVENT' , [ 'SUMMARY' => sprintf ( $ this -> format , $ object -> FN -> getValue ( ) ) , 'DTSTART' => new \ DateTime ( $ object -> BDAY -> getValue ( ) ) , 'RRULE' => 'FREQ=YEARLY' , 'TRANSP' => 'TRANSPARENT' , ] ) ; // add VALUE=date $ event -> DTSTART [ 'VALUE' ] = 'DATE' ; // Add X-SABRE-BDAY property. if ( $ unknownYear ) { $ event -> add ( 'X-SABRE-BDAY' , 'BDAY' , [ 'X-SABRE-VCARD-UID' => $ object -> UID -> getValue ( ) , 'X-SABRE-VCARD-FN' => $ object -> FN -> getValue ( ) , 'X-SABRE-OMIT-YEAR' => self :: DEFAULT_YEAR , ] ) ; } else { $ event -> add ( 'X-SABRE-BDAY' , 'BDAY' , [ 'X-SABRE-VCARD-UID' => $ object -> UID -> getValue ( ) , 'X-SABRE-VCARD-FN' => $ object -> FN -> getValue ( ) , ] ) ; } } return $ calendar ; }
Parses the input data and returns a VCALENDAR.

@return Component/VCalendar
Parses the input data and returns a VCALENDAR .