parent
44672f1f70
commit
3c8b623985
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace jrosset\EnvReader\XmlStructure;
|
||||||
|
|
||||||
|
use SimpleXMLElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Structure about a single attribute
|
||||||
|
*/
|
||||||
|
class AttributeSingleXmlStructure implements IXmlStructure {
|
||||||
|
/**
|
||||||
|
* @var string The attribute name
|
||||||
|
*/
|
||||||
|
private string $attributeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize
|
||||||
|
*
|
||||||
|
* @param string $attributeName The attribute name
|
||||||
|
*/
|
||||||
|
public function __construct (string $attributeName) {
|
||||||
|
$this->attributeName = $attributeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function parseXml (SimpleXMLElement $xmlNode): string {
|
||||||
|
return (string)$xmlNode[$this->attributeName];
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue