-
-
Save mishfish/7bdf6d617b02027d106f338f3e3a70a0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Entity | |
| { | |
| private $value; | |
| public function changeValue(ValueChange $value): void | |
| { | |
| $this->value = $value->value($this); | |
| } | |
| } | |
| class ValueChange | |
| { | |
| private $value; | |
| private $someHeavyLogic; | |
| public function validate(Entity $entity) : void | |
| { | |
| $this->someHeavyLogic->someMethod($entity); | |
| } | |
| public function value(Entity $entity) | |
| { | |
| $this->validate($entity); | |
| return $this->value; | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment