nur-sery/wip/php/access/ValueAccess.php

29 lines
504 B
PHP
Raw Normal View History

2024-08-17 17:03:07 +04:00
<?php
namespace nur\sery\wip\php\access;
/**
* Class ValueAccess: accès à une valeur scalaire
*/
class ValueAccess extends AbstractAccess {
function exists($src): bool {
return $src !== null;
}
function available($src): bool {
return $this->exists($src);
}
function get($src, $default=null) {
if ($src === null) return $default;
else return $src;
}
function set($value, &$dest): void {
$dest = $value;
}
function del(&$dest): void {
$dest = null;
}
}