29 lines
504 B
PHP
29 lines
504 B
PHP
|
<?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;
|
||
|
}
|
||
|
}
|