blob: 794981d63000866f1f9bebf803498b7ee24d7001 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
<?php
/**
* PHPPgAdmin6
*/
namespace PHPPgAdmin\Decorators;
class IfEmptyDecorator extends Decorator
{
public $val;
public $empty;
/**
* @var mixed
*/
public $full;
public function __construct($value, $empty, $full = null)
{
$this->val = $value;
$this->empty = $empty;
if (null !== $full) {
$this->full = $full;
}
}
public function value($fields)
{
$val = Decorator::get_sanitized_value($this->val, $fields);
if (empty($val)) {
return Decorator::get_sanitized_value($this->empty, $fields);
}
return \property_exists($this, 'full') && null !== $this->full ? Decorator::get_sanitized_value($this->full, $fields) : $val;
}
}
|