/** * @return VCardEmail|null */ public static function createFromAttribute(VCardElementAttribute $attr) { $types = array_map('strtoupper', $attr->getParamValues('TYPE')); $typeMap = array_flip($types); if (isset($typeMap['x400'])) { // X.400 is not supported return null; } $item = new VCardEmail(); $item->value = $attr->getValue(); $item->types = $types; return $item; }
/** * @return VCardPhone|null */ public static function createFromAttribute(VCardElementAttribute $attr) { $item = new VCardPhone(); $item->value = $attr->getValue(); $item->valueType = strtoupper($attr->getFirstParamValue('VALUE', 'text')); $item->types = array_map('strtoupper', $attr->getParamValues('TYPE')); return $item; }