Closed tvdijen closed 4 years ago
OK, so the way it is now works as follows:
registerClass('\This\Is\A\Test');
Will lead to a registry like this:
Array(
[\This\Is\A\Test] => Array(
[0] => urn:oasis:names:tc:SAML:2.0:assertion
[1] => Test
)
)
And then getRegisteredClass(Constants::NS_SAML, 'Test');
will output: \This\Is\A\Test
OK, so the way it is now works as follows:
registerClass('\This\Is\A\Test');
Will lead to a registry like this:
Array( [\This\Is\A\Test] => Array( [0] => urn:oasis:names:tc:SAML:2.0:assertion [1] => Test ) )
And then
getRegisteredClass(Constants::NS_SAML, 'Test');
will output:\This\Is\A\Test
Uhm, shouldn't we index it the other way around? In this case it's a little harder to search for occurrences (while insertion in the registry has constant time in both alternatives), and also this opens up the possibility to have multiple classes registered for the same namespace and element name, leading to ambiguous behaviour.
Also, I just checked and it is in fact not possible to use an array as an index, so we would need to transform that into a string. I'd suggest something like the following:
$key = join(
':',
[
urlencode($namespace),
$element
]
);
That way we can keep both insertions and search at linear complexity (O(1)).
Codecov Report
16.66% <0%> (-20.84%)
6 <2> (+2)
100% <100%> (ø)
26 <1> (ø)
100% <0%> (ø)
76% <0%> (+38%)
100% <0%> (ø)
10% <0%> (+2%)
100% <0%> (ø)
40% <0%> (+20%)
100% <0%> (ø)
11% <0%> (ø)
97.71% <0%> (+0.34%)
410% <0%> (+205%)
93.58% <0%> (+0.48%)
82% <0%> (+31%)
Continue to review full report at Codecov.