18 lines
436 B
PHP
18 lines
436 B
PHP
<?php
|
|
|
|
namespace Ulmus\SearchRequest\Attribute\PropertyValueModifier;
|
|
|
|
use Ulmus\SearchRequest\Attribute\PropertyValueModifier;
|
|
|
|
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
|
class Split extends PropertyValueModifier
|
|
{
|
|
public function __construct(
|
|
public string $delimiter = ',',
|
|
) {}
|
|
|
|
public function run(mixed $value) : mixed
|
|
{
|
|
return is_array($value) ? $value : explode($this->delimiter, $value);
|
|
}
|
|
} |