You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.2 KiB
PHP
43 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace jrosset\EnvReader\XmlStructure;
|
|
|
|
use jrosset\ArrayClasses\InsensitiveCaseArrayClass;
|
|
use SimpleXMLElement;
|
|
|
|
/**
|
|
* Implementation for {@see AttributesXmlStructure} property
|
|
*/
|
|
trait TAttributeListXmlStructure {
|
|
/**
|
|
* @var AttributesXmlStructure|null The attribute structure. Null if none
|
|
*/
|
|
private ?AttributesXmlStructure $attributesStructure = null;
|
|
|
|
/**
|
|
* Set the attribute structure
|
|
*
|
|
* @param AttributesXmlStructure|null $attributesStructure The new attribute structure. Null if none
|
|
*
|
|
* @return $this
|
|
*/
|
|
public function setAttributesStructure (?AttributesXmlStructure $attributesStructure = null): self {
|
|
$this->attributesStructure = $attributesStructure;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Parse the attributes
|
|
*
|
|
* @param SimpleXMLElement $xmlNode The XML node
|
|
*
|
|
* @return mixed The extracted attributes
|
|
*/
|
|
protected function parseXmlAttributes (SimpleXMLElement $xmlNode): InsensitiveCaseArrayClass {
|
|
if ($this->attributesStructure === null) {
|
|
return new InsensitiveCaseArrayClass();
|
|
}
|
|
|
|
return $this->attributesStructure->parseXml($xmlNode);
|
|
}
|
|
} |