Skip to content

Commit 14d4efb

Browse files
not use abstract class as interface
1 parent c1e704c commit 14d4efb

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

‎README.md‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,14 +1014,12 @@ class HttpRequester
10141014
**Good:**
10151015

10161016
```php
1017-
abstract class Adapter
1017+
interface Adapter
10181018
{
1019-
abstract protected function getName();
1020-
1021-
abstract public function request($url);
1019+
public function request($url);
10221020
}
10231021

1024-
class AjaxAdapter extends Adapter
1022+
class AjaxAdapter implements Adapter
10251023
{
10261024
protected function getName()
10271025
{
@@ -1034,7 +1032,7 @@ class AjaxAdapter extends Adapter
10341032
}
10351033
}
10361034

1037-
class NodeAdapter extends Adapter
1035+
class NodeAdapter implements Adapter
10381036
{
10391037
protected function getName()
10401038
{
@@ -1061,13 +1059,12 @@ class HttpRequester
10611059
return $this->adapter->request($url);
10621060
}
10631061
}
1064-
10651062
```
10661063

10671064
**[⬆ back to top](#table-of-contents)**
10681065

1069-
10701066
### Liskov Substitution Principle (LSP)
1067+
10711068
This is a scary term for a very simple concept. It's formally defined as "If S
10721069
is a subtype of T, then objects of type T may be replaced with objects of type S
10731070
(i.e., objects of type S may substitute objects of type T) without altering any

0 commit comments

Comments
 (0)