Remove the feeds module
This commit is contained in:
parent
acfd1cca8d
commit
0c98be96eb
851 changed files with 840 additions and 10348 deletions
|
@ -87,14 +87,5 @@
|
|||
"processed": "\n <p>Decorator is a structural design pattern that allows you to add extra functionality, such as if you want to add caching or logging to a service, without changing the original class.<\/p>\n\n<p>As long as a class implements an Interface, it can be decorated.<\/p>\n\n<p>For example, if I have this PHP interface:<\/p>\n\n<pre><code class=\"language-php\">interface DoesSomething\n{\n public function doSomething(): void;\n}\n<\/code><\/pre>\n\n<p>I could have this class that does something:<\/p>\n\n<pre><code class=\"language-php\">final class FirstClass implements DoesSomething\n{\n public function doSomething(): void\n {\n \/\/ Does something.\n }\n}\n<\/code><\/pre>\n\n<p>If I need to do something else, like caching or logging the result, I can decorate it.<\/p>\n\n<p>To do this, I need another class that implements the same interface and inject the original version.<\/p>\n\n<pre><code class=\"language-php\">final class SecondClass implements DoesSomething\n{\n public function __constuct(\n private DoesSomething $originalClass\n ) {}\n\n public function doSomething()\n {\n \/\/ Do something else before.\n\n $this->originalClass->doSomething();\n\n \/\/ Do something else afterwards.\n }\n}\n<\/code><\/pre>\n\n<p>Within the new class, the methods can be overridden, extra functionality can be added, and the original method can be run to execute the original functionality.<\/p>\n\n<p>As the two classes implement the same interface, I can swap between different versions and decorate multiple times if needed.<\/p>\n\n<p>This a pattern that I used recently to extend a service that retrieved some data from an API and saved it to a file, to change some arguments and do more work with it.<\/p>\n\n<p>The original class was unchanged, the new class was minimal and easy to understand as it only had a single responsibility, and if I needed to switch back to the original version, I could easily do that.<\/p>\n\n ",
|
||||
"summary": null
|
||||
}
|
||||
],
|
||||
"feeds_item": [
|
||||
{
|
||||
"imported": "1970-01-01T00:32:50+00:00",
|
||||
"guid": null,
|
||||
"hash": "02610d24642398171de58810a96abcd6",
|
||||
"target_type": "feeds_feed",
|
||||
"target_uuid": "90c85284-7ca8-4074-9178-97ff8384fe76"
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue