1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
<?php
namespace Gedcomx\Util;
class XmlMapper
{
private static $collection;
private static function init(){
self::$collection = new Collection(array(
'Gedcomx\Gedcomx' => 'gedcomx',
'Gedcomx\Agent\Agent' => 'agents',
'Gedcomx\Atom\Entry' => 'entries',
'Gedcomx\Common\Attribution' => 'attribution',
'Gedcomx\Common\CustomKeyedItem' => 'customKeys',
'Gedcomx\Common\EvidenceReference' => 'evidence',
'Gedcomx\Common\Note' => 'notes',
'Gedcomx\Common\ResourceReference' => 'resourceReference',
'Gedcomx\Common\UniqueCustomKeyedItem' => 'ucustomKeys',
'Gedcomx\Conclusion\Document' => 'documents',
'Gedcomx\Conclusion\Event' => 'events',
'Gedcomx\Conclusion\Fact' => 'facts',
'Gedcomx\Conclusion\Gender' => 'genders',
'Gedcomx\Conclusion\Name' => 'names',
'Gedcomx\Conclusion\Person' => 'persons',
'Gedcomx\Conclusion\Relationship' => 'relationships',
'Gedcomx\Extensions\FamilySearch\FamilySearchPlatform' => 'familysearch',
'Gedcomx\Extensions\FamilySearch\Platform\Error' => 'errors',
'Gedcomx\Extensions\FamilySearch\Platform\HealthConfig' => 'healthConfig',
'Gedcomx\Extensions\FamilySearch\Platform\Tag' => 'tags',
'Gedcomx\Extensions\FamilySearch\Platform\Artifacts\ArtifactMetadata' => 'artifactMetaData',
'Gedcomx\Extensions\FamilySearch\Platform\Discussions\Discussion' => 'discussions',
'Gedcomx\Extensions\FamilySearch\Platform\Tree\ChangeInfo' => 'changeInfo',
'Gedcomx\Extensions\FamilySearch\Platform\Tree\ChildAndParentsRelationship' => 'child-and-parents-relationships',
'Gedcomx\Extensions\FamilySearch\Platform\Tree\DiscussionReference' => 'discussion-references',
'Gedcomx\Extensions\FamilySearch\Platform\Tree\MatchInfo' => 'matchInfo',
'Gedcomx\Extensions\FamilySearch\Platform\Tree\Merge' => 'merge',
'Gedcomx\Extensions\FamilySearch\Platform\Tree\MergeAnalysis' => 'mergeAnalysis',
'Gedcomx\Extensions\FamilySearch\Platform\Tree\mergeConflict' => 'mergeConflict',
'Gedcomx\Extensions\FamilySearch\Platform\Users\User' => 'users',
'Gedcomx\Links\Link' => 'links',
'Gedcomx\Records\Collection' => 'collections',
'Gedcomx\Records\CollectionContent' => 'collectionContent',
'Gedcomx\Records\Field' => 'fields',
'Gedcomx\Records\RecordDescription' => 'recordDescriptors',
'Gedcomx\Records\RecordSet' => 'records',
'Gedcomx\Source\Coverage' => 'coverage',
'Gedcomx\Source\SourceDescription' => 'sourceDescriptions',
'Gedcomx\Source\SourceReference' => 'sourceReferences',
));
}
private static function collection(){
if (self::$collection == null) {
self::init();
}
return self::$collection;
}
public static function isKnownType($tagName){
return self::collection()->contains($tagName);
}
public static function getTagName($class)
{
return self::collection()->get($class);
}
public static function getClassName($tagName)
{
return self::collection()->getKey($tagName);
}
}