25 lines
537 B
PHP
25 lines
537 B
PHP
|
<?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);
|
||
|
}
|
||
|
}
|