19declare(strict_types=1);
27use InvalidArgumentException;
51 if (!is_string($from)) {
52 throw new InvalidArgumentException(__METHOD__ .
" the argument is not a string.");
55 return explode($this->delimiter, $from);
63 $dataValue = $result->
value();
64 if (
false === is_string($dataValue)) {
65 $exception =
new InvalidArgumentException(__METHOD__ .
" the argument is not a string.");
66 return $this->
factory->error($exception);
69 $value = explode($this->delimiter, $dataValue);
70 return $this->
factory->ok($value);
Split a string by delimiter into array.
__construct(string $delimiter, Factory $factory)
applyTo(Result $result)
@inheritDoc
transform($from)
@inheritDoc
trait DeriveInvokeFromTransform
A result encapsulates a value or an error and simplifies the handling of those.
value()
Get the encapsulated value.