Skip to content

Commit

Permalink
Complete the getting_started.md file
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Ben87 committed Jun 3, 2023
1 parent 7337f3b commit e579e5d
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,45 @@ First make sure you have [installed Behat][1].
Usage
=====

Refer to each adapter's documentation.
The entrypoint of the library is the [Presta\BehatParser\Evaluator][2] class.

Invoke it with an input value and retrieve the value after it has been evaluated and possibly modified by each registered [Presta\BehatParser\Adapter\AdapterInterface][3] sequentially.

```php
<?php

use Presta\BehatParser\Adapter\AdapterInterface;use Presta\BehatParser\Evaluator;

/** @var list<AdapterInterface> $adapters */
$adapters = [
// ...
];

$evaluate = new Evaluator($adapters);
$value = $evaluate('any value');
```

How it works?
=============

TODO
The [Presta\BehatParser\Evaluator][2] takes a collection of [Presta\BehatParser\Adapter\AdapterInterface][3] which will be invoked sequentially to evaluate the input value.

Each adapter is responsible to decide whether or not it should modify the input value.
Internally, they may use simple PHP functions, regexes or even the [Symfony Expression Language][4] component to evaluate and modify the input value.

In the end, the value will be returned after having been modified (or not) by one or several adapters.

That was it!
============

---

You may return to the [README.md][2] or read other [adapters documentation files][3].
You may return to the [README.md][5] or refer to the [evaluator][6] or the [adapters][7] documentation files.

[1]: https://behat.org/en/latest/quick_start.html#installation
[2]: ../README.md
[3]: ./adapters/
[2]: ../src/Evaluator.php
[3]: ../src/Adapter/AdapterInterface.php
[4]: https://symfony.com/doc/current/components/expression_language.html
[5]: ../README.md
[6]: ./evaluator.md
[7]: ./adapters

0 comments on commit e579e5d

Please sign in to comment.