Skip to content

Commit 11c43b1

Browse files
committed
Update README file
1 parent e36d368 commit 11c43b1

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ the context of domain-driven design." -- [wikipedia](https://en.wikipedia.org/wi
2929

3030
### How do I use it?
3131

32-
Each object added to one of the logical instance must implement the `Bakame\Specification\Specification` interface.
32+
Each rule that needs to be used MUST implement the `Bakame\Specification\Specification` interface.
3333

34-
Here's a quick example. First you create your Specification implementing class.
34+
Here's a quick example. First, create a specification implementing class.
3535

3636
~~~php
3737
<?php
@@ -53,8 +53,9 @@ final class OverDueSpecification implements Specification
5353
}
5454
~~~
5555

56-
Then using the special `Bakame\Specification\Chain` class and all the specifications you have
57-
created you can link all specification as needed.
56+
Then using the decorator class `Bakame\Specification\Chain` and all the specifications
57+
created, it becomes straightforward to logically apply all the specification
58+
as expected by your business rules.
5859

5960
Here's how the Wikipedia page example is adapted using the library.
6061

@@ -87,21 +88,21 @@ to allow the implementations of complex business rules.
8788
| Classes | Logical usage | Chain methods |
8889
|---------|--------------------------------------------------------------------|---------------------------------|
8990
| All | All specifications must be satisfied by the subject | `Chain::all` named constructor |
90-
| AndX | Combined two specifications where both must be satisfied | `Chain::andX` method |
9191
| Any | At least one of the specifications provided must be satisfied | `Chain::any` named constructor |
9292
| None | None of all provided specification must be satisfied by the author | `Chain::none` named constructor |
93+
| AndX | Combined two specifications where both must be satisfied | `Chain::andX` method |
9394
| OrX | Combined two specifications where at least one must be satisfied | `Chain::orX` method |
9495
| Not | Returns the opposite result of the provided specification | `Chain::not` method |
9596

96-
Creating your own specification is straightforward as you can see below.
97+
Creating more complex rules that you can individually test becomes trivial as do their maintenance.
9798

9899
~~~php
99100
<?php
100101

101102
use App\Specification\MustHaveFourLegs;
102103
use App\Specification\MustHaveStripes;
103104
use App\Specification\IsLizard;
104-
use Bakame\Specification;
105+
use Bakame\Specification\Chain;
105106

106107
$allSpecs = Chain::all(new MustHaveFourLegs(), new MustHaveStripes());
107108
$anySpec = $allSpecs->orX(new IsLizard());

0 commit comments

Comments
 (0)