Valinor/docs/pages
Romain Canon ad1207153e feat!: rework messages body and parameters features
The `\CuyZ\Valinor\Mapper\Tree\Message\Message` interface is no longer
a `Stringable`, however it defines a new method `body` that must return
the body of the message, which can contain placeholders that will be
replaced by parameters.

These parameters can now be defined by implementing the interface
`\CuyZ\Valinor\Mapper\Tree\Message\HasParameters`.

This leads to the deprecation of the no longer needed interface
`\CuyZ\Valinor\Mapper\Tree\Message\TranslatableMessage` which had a
confusing name.

```php
final class SomeException
    extends DomainException
    implements ErrorMessage, HasParameters, HasCode
{
    private string $someParameter;

    public function __construct(string $someParameter)
    {
        parent::__construct();

        $this->someParameter = $someParameter;
    }

    public function body() : string
    {
        return 'Some message / {some_parameter} / {source_value}';
    }

    public function parameters(): array
    {
        return [
            'some_parameter' => $this->someParameter,
        ];
    }

    public function code() : string
    {
        // A unique code that can help to identify the error
        return 'some_unique_code';
    }
}
```
2022-07-25 22:05:31 +02:00
..
img doc: add Open Graph meta tags 2022-06-12 16:37:58 +02:00
mapping feat!: make mapper more strict and allow flexible mode 2022-06-23 10:30:36 +02:00
other doc: introduce mkdocs as a static documentation generator 2022-06-10 17:32:07 +02:00
stylesheets doc: change some settings and adjust logos 2022-06-10 23:33:28 +02:00
changelog.md release: version 0.12.0 2022-07-10 19:57:21 +02:00
credits.md doc: introduce mkdocs as a static documentation generator 2022-06-10 17:32:07 +02:00
getting-started.md doc: introduce mkdocs as a static documentation generator 2022-06-10 17:32:07 +02:00
index.md doc: remove badges from documentation index 2022-06-11 12:48:35 +02:00
message-customization.md feat!: refactor tree node API 2022-07-10 19:28:36 +02:00
robots.txt doc: improve documentation building process 2022-06-22 11:15:26 +02:00
source.md doc: introduce mkdocs as a static documentation generator 2022-06-10 17:32:07 +02:00
validation.md feat!: rework messages body and parameters features 2022-07-25 22:05:31 +02:00