Source: ugur-muslim.medium.com

DECORATOR PATTERN — PHP
This pattern is really enjoyable because it is like you wrap a present box and another one is infront of your eyes. If you want to see the other patterns you can visit these below links.

For example you got a team with some stats and you want to calulate them with some default multipliers.

Let’s do it; There is a team cla ss for the sake of the arguement and let’s say we can create the object with stats; We can do something like this but this is problematic in various ways; But what if after a while if you decide to give another option to intelligence like gettiing the square of this calculaton; So everytime you do something it will probably trigger some other areas in your project and changing the would be a must maybe. Let’s do it with simple Decoration; Written by
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners