Skip to content

Commit b56e406

Browse files
Nyholmdbu
authored andcommitted
Added a word of Adapter pattern and Liskov (#127)
Added a word on Adapter pattern and Liskov substitution principle
1 parent 4720a5d commit b56e406

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

clients.rst

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
Clients & Adapters
22
==================
33

4-
There are clients implementing one of the HTTPlug interfaces directly,
5-
and adapter packages that implement the interface and forward the calls to HTTP clients not implementing the interface.
4+
There are two types of libraries you can use to send HTTP messages; clients and adapters. A client implements the
5+
``HttpClient`` and/or the ``HttpAsyncClient`` interfaces directly. A client adapter is a class implementing the
6+
interface and forwarding the calls to an HTTP client not implementing the interface. (See `Adapter pattern`_ on Wikipedia).
67

7-
.. _`php-http/client-implementation`: https://packagist.org/providers/php-http/client-implementation
8-
.. _`php-http/async-client-implementation`: https://packagist.org/providers/php-http/async-client-implementation:
8+
.. note::
99

10+
All clients and adapters comply with `Liskov substitution principle`_ which means that you can easily change one
11+
for another without any side effects.
1012

1113
Clients:
1214

@@ -29,9 +31,13 @@ Composer Virtual Packages
2931
-------------------------
3032

3133
Virtual packages are a way to specify the dependency on an implementation of an interface-only repository
32-
without forcing a specific implementation. For HTTPlug, the virtual package is called ``php-http/client-implementation``.
34+
without forcing a specific implementation. For HTTPlug, the virtual packages are called `php-http/client-implementation`_
35+
and `php-http/async-client-implementation`_.
3336

34-
There is no project registered with that name. However, all client implementations including client adapters for
37+
There is no library registered with those names. However, all client implementations (including client adapters) for
3538
HTTPlug use the ``provide`` section to tell composer that they do provide the client-implementation.
3639

37-
40+
.. _`php-http/client-implementation`: https://packagist.org/providers/php-http/client-implementation
41+
.. _`php-http/async-client-implementation`: https://packagist.org/providers/php-http/async-client-implementation
42+
.. _`Adapter pattern`: https://en.wikipedia.org/wiki/Adapter_pattern
43+
.. _`Liskov substitution principle`: https://en.wikipedia.org/wiki/Liskov_substitution_principle

spelling_word_list.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ toolbar
2929
username
3030
whitelist
3131
wiki
32+
Wikipedia
3233
workflow

0 commit comments

Comments
 (0)