mirror of
https://github.com/danog/Valinor.git
synced 2025-01-07 13:18:25 +01:00
a805ba0442
A new class `NodeMessage` is used to wrap messages added to a node during the mapping. This class will allow further features by giving access to useful data related to the bound node. BREAKING CHANGE: as of now every message is wrapped into a `NodeMessage` it is therefore not possible to check whether the message is an instance of `Throwable` — a new method `$message->isError()` is now to be used for such cases.
29 lines
542 B
PHP
29 lines
542 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace CuyZ\Valinor\Tests\Fake\Mapper\Tree\Message;
|
|
|
|
use CuyZ\Valinor\Mapper\Tree\Message\HasCode;
|
|
use CuyZ\Valinor\Mapper\Tree\Message\Message;
|
|
|
|
final class FakeMessage implements Message, HasCode
|
|
{
|
|
private string $message;
|
|
|
|
public function __construct(string $message = 'some message')
|
|
{
|
|
$this->message = $message;
|
|
}
|
|
|
|
public function __toString(): string
|
|
{
|
|
return $this->message;
|
|
}
|
|
|
|
public function code(): string
|
|
{
|
|
return 'some_code';
|
|
}
|
|
}
|