for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace SimpleSAML\SAML2\XML\md;
use DOMElement;
use SimpleSAML\Assert\Assert;
use SimpleSAML\XML\ArrayizableElementInterface;
use SimpleSAML\XML\StringElementTrait;
/**
* Class implementing TelephoneNumber.
*
* @package simplesamlphp/saml2
*/
final class TelephoneNumber extends AbstractMdElement implements ArrayizableElementInterface
{
use StringElementTrait;
* @param string $content
public function __construct(string $content)
$this->setContent($content);
}
* Validate the content of the element.
* @param string $content The value to go in the XML textContent
* @throws \Exception on failure
* @return void
protected function validateContent(string $content): void
Assert::notEmpty($content, 'TelephoneNumber cannot be empty');
* Create a class from an array
* @param array $data
* @return static
public static function fromArray(array $data): static
self::validateArray($data);
$index = array_key_first($data);
return new static($data[$index]);
* Validate an array
public static function validateArray(array $data): void
Assert::notEmpty($data);
Assert::count($data, 1);
Assert::allString($data);
* Create an array from this class
* @return array
public function toArray(): array
return [$this->getContent()];