nur-sery/nur_src/ldap/syntaxes/TelephoneSyntax.php

25 lines
537 B
PHP
Raw Normal View History

2024-04-04 22:21:20 +04:00
<?php
namespace nur\ldap\syntaxes;
use nur\data\types\TelephoneType;
class TelephoneSyntax extends StringSyntax {
function __construct() {
$this->type = new TelephoneType();
}
/** @var TelephoneType */
protected $type;
function php2ldap($value): ?string {
$value = parent::php2ldap($value);
if ($value === null) return null;
$type = $this->type;
return $type->ensureInternational($type->with($value));
}
function ldap2php(string $value): string {
return $this->type->ensureLocal($value);
}
}