- Added a Trim PropertyValueModifier
This commit is contained in:
parent
2e45eba520
commit
2271b0b034
18
src/SearchRequest/Attribute/PropertyValueModifier/Trim.php
Normal file
18
src/SearchRequest/Attribute/PropertyValueModifier/Trim.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Ulmus\SearchRequest\Attribute\PropertyValueModifier;
|
||||||
|
|
||||||
|
use Ulmus\SearchRequest\Attribute\PropertyValueModifier;
|
||||||
|
|
||||||
|
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
||||||
|
class Trim extends PropertyValueModifier
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
public string $characters = ' \t',
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public function run(mixed $value) : mixed
|
||||||
|
{
|
||||||
|
return trim($value, $this->characters);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user