2024-04-04 22:21:20 +04:00
|
|
|
<?php
|
|
|
|
namespace nur\ldap\syntaxes;
|
|
|
|
|
|
|
|
use nur\data\types\TelephoneType;
|
2024-04-29 16:39:43 +04:00
|
|
|
use nur\ldap\labels;
|
2024-04-04 22:21:20 +04:00
|
|
|
|
|
|
|
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;
|
2024-04-29 16:39:43 +04:00
|
|
|
labels::strip($value, $label);
|
2024-04-04 22:21:20 +04:00
|
|
|
$type = $this->type;
|
2024-04-29 16:39:43 +04:00
|
|
|
$value = $type->ensureInternational($type->with($value));
|
|
|
|
return labels::add($value, $label);
|
2024-04-04 22:21:20 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
function ldap2php(string $value): string {
|
2024-04-29 16:39:43 +04:00
|
|
|
labels::strip($value, $label);
|
|
|
|
$value = $this->type->ensureLocal($value);
|
|
|
|
return labels::add($value, $label);
|
2024-04-04 22:21:20 +04:00
|
|
|
}
|
|
|
|
}
|