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

23 lines
469 B
PHP
Raw Normal View History

2024-04-04 22:21:20 +04:00
<?php
namespace nur\ldap\syntaxes;
class BooleanSyntax extends AbstractSyntax {
function getPhpType(): ?string {
return "bool";
}
function php2ldap($value): ?string {
if ($value === null) return null;
else return $value? "TRUE": "FALSE";
}
function fromPhp($values): ?array {
if (is_bool($values)) $values = [$values];
return parent::fromPhp($values);
}
function ldap2php(string $value): bool {
return $value === "TRUE";
}
}