23 lines
469 B
PHP
23 lines
469 B
PHP
|
<?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";
|
||
|
}
|
||
|
}
|