| Conditions | 4 |
| Paths | 3 |
| Total Lines | 59 |
| Code Lines | 40 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 53 | public const array XS_ANY_ELT_EXCLUSIONS = [ |
||
| 54 | ['urn:oasis:names:tc:SAML:2.0:assertion', '*'], |
||
| 55 | ['urn:oasis:names:tc:SAML:2.0:metadata', '*'], |
||
| 56 | ['urn:oasis:names:tc:SAML:2.0:protocol', '*'], |
||
| 57 | ]; |
||
| 58 | |||
| 59 | |||
| 60 | /** |
||
| 61 | * Create an Extensions object from its md:Extensions XML representation. |
||
| 62 | * |
||
| 63 | * For those supported extensions, an object of the corresponding class will be created. |
||
| 64 | * The rest will be added as a \SimpleSAML\XML\Chunk object. |
||
| 65 | * |
||
| 66 | * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException |
||
| 67 | * if the qualified name of the supplied element is wrong |
||
| 68 | */ |
||
| 69 | public static function fromXML(DOMElement $xml): static |
||
| 70 | { |
||
| 71 | Assert::eq( |
||
| 72 | $xml->namespaceURI, |
||
| 73 | self::NS, |
||
| 74 | 'Unknown namespace \'' . strval($xml->namespaceURI) . '\' for Extensions element.', |
||
| 75 | InvalidDOMElementException::class, |
||
| 76 | ); |
||
| 77 | Assert::eq( |
||
| 78 | $xml->localName, |
||
| 79 | static::getClassName(static::class), |
||
| 80 | 'Invalid Extensions element \'' . $xml->localName . '\'', |
||
| 81 | InvalidDOMElementException::class, |
||
| 82 | ); |
||
| 83 | $ret = []; |
||
| 84 | $supported = [ |
||
| 85 | RepublishRequest::NS => [ |
||
| 86 | 'RepublishRequest' => RepublishRequest::class, |
||
| 87 | ], |
||
| 88 | DiscoveryResponse::NS => [ |
||
| 89 | 'DiscoveryResponse' => DiscoveryResponse::class, |
||
| 90 | ], |
||
| 91 | Scope::NS => [ |
||
| 92 | 'Scope' => Scope::class, |
||
| 93 | ], |
||
| 94 | EntityAttributes::NS => [ |
||
| 95 | 'EntityAttributes' => EntityAttributes::class, |
||
| 96 | ], |
||
| 97 | MDRPI::NS => [ |
||
| 98 | 'RegistrationInfo' => RegistrationInfo::class, |
||
| 99 | 'PublicationInfo' => PublicationInfo::class, |
||
| 100 | 'PublicationPath' => PublicationPath::class, |
||
| 101 | ], |
||
| 102 | MDUI::NS => [ |
||
| 103 | 'UIInfo' => UIInfo::class, |
||
| 104 | 'DiscoHints' => DiscoHints::class, |
||
| 105 | ], |
||
| 106 | ALG::NS => [ |
||
| 107 | 'DigestMethod' => DigestMethod::class, |
||
| 108 | 'SigningMethod' => SigningMethod::class, |
||
| 109 | ], |
||
| 110 | RequestInitiator::NS => [ |
||
| 111 | 'RequestInitiator' => RequestInitiator::class, |
||
| 112 | ], |
||
| 130 |