Skip to content

Commit

Permalink
fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
imanghafoori1 committed Apr 25, 2024
1 parent e76b85d commit e30315b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ composer require imanghafoori/laravel-decorator

A decorator is callable which wraps around the original decorated callable, in order to form a new callable composed of the previous two.

Like a python snake swallowing a deer whole and wraps around it's body !
Like a python snake swallowing a deer whole and wraps around its body !

After that the snake becomes capable to eat and digest grasses :herb: because it has a deer inside it.

Technically, A `"Decorator"`:

1- Is a "callable"

2- which takes an other "callable" (as it's only argument, like a snake swallows an other snake)
2- which takes another "callable" (as it's only argument, like a snake swallows another snake)

3- and returns a new `"callable"` (which internally calls the original `callable`, putting some code before and after it.)

Expand All @@ -62,11 +62,11 @@ Then after a while you decide to put a cache layer between those two classes for
According to SOLID principles, you shouldn't put the caching code logic neither in your controller nor your UserRepo.
But somewhere in between.

In other words, you want to add a new feature (caching in this case) without modifing the existing code.
In other words, you want to add a new feature (caching in this case) without modifying the existing code.

It smells like `Open-closed Principle` Yeah?! 👃

You want to keep the responsibilities seperate. In this case `caching` should not be in a repository or controller but in it's own class.
You want to keep the responsibilities separate. In this case `caching` should not be in a repository or controller but in its own class.

It smells like `Single Responsibility Principle` yeah?! 👃

Expand All @@ -91,7 +91,7 @@ class MadUsersController extends Controller
```
ok now there is no cache, going on. it is a direct call.

With the help of laravel-decorator built-in cache decorator, you can go to `AppServiceProvider.php` or any other service provider
With the help of laravel-decorator built-in cache decorator, you can go to `AppServiceProvider.php` (or any other service provider):

```php
<?php
Expand All @@ -116,7 +116,7 @@ class AppServiceProvider extends ServiceProvider
```

You will get cached results from your calls, in your `UserController` without touching it!
but rememnber to change:
but remember to change:

```php
app()->call('UserRepository@find', ...
Expand Down Expand Up @@ -150,13 +150,13 @@ Then you can use this name (`myDecoratorName`) to decorate methods.
// You may set multiple decorators on a single method...
\Decorator::decorate('class@method, 'someClass@someOtherDecorator'); // (first)

// or reference the decorator by it's name :
// or reference the decorator by its name :
\Decorator::decorate('class@method, 'myDecoratorName'); // (second)

```


### How to call a method with it's decorators?
### How to call a method with its decorators?

![image](https://user-images.githubusercontent.com/6961695/51078628-970f9b80-16cd-11e9-8b23-267b2d1564e7.png)

Expand Down Expand Up @@ -198,7 +198,7 @@ But if you return only `int` and your decorator causes the `null` value to be fi

### :star: Your Stars Make Us Do More :star:

As always if you found this package useful and you want to encourage us to maintain and work on it, Please `press the star button` to declare your willingness.
As always if you found this package useful, and you want to encourage us to maintain and work on it, Please `press the star button` to declare your willingness.


### More packages from the author:
Expand All @@ -215,7 +215,7 @@ As always if you found this package useful and you want to encourage us to maint

------------

:gem: It allows you login with any password in local environment only.
:gem: It allows you log in with any password in local environment only.

- https://github.com/imanghafoori1/laravel-anypass

Expand Down

0 comments on commit e30315b

Please sign in to comment.