From e579e5ded9e91942eedf3489d8c39f8dad63458a Mon Sep 17 00:00:00 2001 From: Benoit Jouhaud Date: Sun, 4 Jun 2023 00:35:12 +0200 Subject: [PATCH] Complete the getting_started.md file --- docs/getting_started.md | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/docs/getting_started.md b/docs/getting_started.md index dc4101a..ad1c150 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -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 + $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