Code Duplication    Length = 10-10 lines in 2 locations

src/LightSaml/Model/Metadata/Metadata.php 1 location

@@ 74-83 (lines=10) @@
71
72
        $rootElementName = $node->localName;
73
74
        if (array_key_exists($rootElementName, $map)) {
75
            if ($class = $map[$rootElementName]) {
76
                /** @var SamlElementInterface $result */
77
                $result = new $class();
78
            } else {
79
                throw new \LogicException('Deserialization of %s root element is not implemented');
80
            }
81
        } else {
82
            throw new LightSamlXmlException(sprintf("Unknown SAML metadata '%s'", $rootElementName));
83
        }
84
85
        $result->deserialize($node, $context);
86

src/LightSaml/Model/Protocol/SamlMessage.php 1 location

@@ 94-103 (lines=10) @@
91
92
        $rootElementName = $node->localName;
93
94
        if (array_key_exists($rootElementName, $map)) {
95
            if ($class = $map[$rootElementName]) {
96
                /** @var SamlElementInterface $result */
97
                $result = new $class();
98
            } else {
99
                throw new \LogicException('Deserialization of %s root element is not implemented');
100
            }
101
        } else {
102
            throw new LightSamlXmlException(sprintf("Unknown SAML message '%s'", $rootElementName));
103
        }
104
105
        $result->deserialize($node, $context);
106