| Total Complexity | 13 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | abstract class AbstractTagOperationElement extends Tag |
||
| 10 | { |
||
| 11 | public const ATTRIBUTE_MESSAGE = 'message'; |
||
| 12 | |||
| 13 | 2 | public function getParentOperation(): ?TagOperation |
|
| 14 | { |
||
| 15 | 2 | return $this->getStrictParent(AbstractDocument::TAG_OPERATION); |
|
|
|
|||
| 16 | } |
||
| 17 | |||
| 18 | 20 | public function hasAttributeMessage(): bool |
|
| 19 | { |
||
| 20 | 20 | return $this->hasAttribute(self::ATTRIBUTE_MESSAGE); |
|
| 21 | } |
||
| 22 | |||
| 23 | 20 | public function getAttributeMessage(): string |
|
| 26 | } |
||
| 27 | |||
| 28 | 2 | public function getAttributeMessageNamespace(): ?string |
|
| 29 | { |
||
| 30 | 2 | return $this->hasAttribute(self::ATTRIBUTE_MESSAGE) ? $this->getAttribute(self::ATTRIBUTE_MESSAGE)->getValueNamespace() : null; |
|
| 31 | } |
||
| 32 | |||
| 33 | 18 | public function getMessage(): ?TagMessage |
|
| 34 | { |
||
| 35 | 18 | $message = null; |
|
| 36 | 18 | $messageName = $this->getAttributeMessage(); |
|
| 37 | |||
| 38 | 18 | if (!empty($messageName)) { |
|
| 39 | 18 | $message = $this->getDomDocumentHandler()->getElementByNameAndAttributes(AbstractDocument::TAG_MESSAGE, [ |
|
| 40 | 18 | 'name' => $messageName, |
|
| 41 | 18 | ], true); |
|
| 42 | } |
||
| 43 | |||
| 44 | 18 | return $message; |
|
| 45 | } |
||
| 46 | |||
| 47 | 2 | public function getParts(): ?array |
|
| 48 | { |
||
| 49 | 2 | $parts = null; |
|
| 50 | 2 | $message = $this->getMessage(); |
|
| 51 | 2 | if ($message instanceof TagMessage) { |
|
| 52 | 2 | $parts = $message->getChildrenByName(AbstractDocument::TAG_PART); |
|
| 53 | } |
||
| 54 | |||
| 55 | 2 | return $parts; |
|
| 56 | } |
||
| 57 | |||
| 58 | 14 | public function getPart(string $partName): ?TagPart |
|
| 67 | } |
||
| 68 | } |
||
| 69 |