| 1 |
<?php |
| 2 |
|
| 3 |
namespace QuadLayers\WP_Orm\Tests\Single; |
| 4 |
|
| 5 |
class SingleEntityTest extends \QuadLayers\WP_Orm\Entity\SingleEntity |
| 6 |
{ |
| 7 |
public static $sanitizeProperties = [ |
| 8 |
'key1' => 'strval', |
| 9 |
'key2' => 'strval', |
| 10 |
'key3' => self::class . '::sanitizeKey3', |
| 11 |
'key4' => 'self::sanitizeKey4', |
| 12 |
'key5' => '$this->sanitizeKey5', |
| 13 |
]; |
| 14 |
|
| 15 |
public string $key1 = 'default_value_1'; |
| 16 |
public string $key2 = 'default_value_2'; |
| 17 |
public string $key3 = '3'; |
| 18 |
public int $key4 = 3; |
| 19 |
public string $key5 = 'Test Alternative'; |
| 20 |
|
| 21 |
public static function sanitizeKey3($value) |
| 22 |
{ |
| 23 |
if (is_numeric($value)) { |
| 24 |
return (string) $value; |
| 25 |
} |
| 26 |
return '0'; |
| 27 |
} |
| 28 |
|
| 29 |
public static function sanitizeKey4($value) |
| 30 |
{ |
| 31 |
return (int) $value; |
| 32 |
} |
| 33 |
|
| 34 |
public function sanitizeKey5($value = null) |
| 35 |
{ |
| 36 |
return 'Test Alternative'; |
| 37 |
} |
| 38 |
} |
| 39 |
|