43 if (!is_string($from)) {
44 throw new \InvalidArgumentException(__METHOD__ .
" the argument is not a string.");
47 return explode($this->delimiter, $from);
55 $dataValue = $data->
value();
56 if (
false === is_string($dataValue)) {
57 $exception = new \InvalidArgumentException(__METHOD__ .
" the argument is not a string.");
58 return $this->factory->error($exception);
61 $value = explode($this->delimiter, $dataValue);
62 return $this->factory->ok($value);
value()
Get the encapsulated value.
__construct($delimiter, Factory $factory)
applyTo(Result $data)
Perform the transformation and reify possible failures.If $data->isError(), the method MUST do nothin...
Split a string by delimiter into array.
A result encapsulates a value or an error and simplifies the handling of those.
transform($from)
Perform the transformation.Please use this for transformations. It's more performant than calling inv...
trait DeriveInvokeFromTransform