19 declare(strict_types=1);
33 public function __construct(
string $todo, array $accepted = [])
41 return ord($this->todo);
46 return new Ok((
new self(
47 substr($this->todo, 1),
52 public function push(array $values): self
56 array_merge($this->
accepted, $values)
62 return new Error(
'Rejected.');
70 public function done(): bool
96 $string .= $data->value();
99 return $transform($string);
Class for internal usage of Intermediate.
A result encapsulates a value or an error and simplifies the handling of those.