Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. <?php
  2.  
  3. interface NameInterface
  4. {
  5. public function getName();
  6. }
  7.  
  8. abstract class ValueObject implements NameInterface
  9. {
  10. protected $name;
  11.  
  12. public function getName()
  13. {
  14. return $this->name;
  15. }
  16. }
  17.  
  18. class Concrete extends ValueObject
  19. {
  20. public function setValue($value)
  21. {
  22. $this->name = $value;
  23.  
  24. return $this;
  25. }
  26. }
  27.  
  28. $c = (new Concrete())->setValue('test name');
  29. echo $c->getName();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement