Last active
July 9, 2019 01:26
-
-
Save zgoniaiko/8418d71467af17d81eb1859a476ab09d to your computer and use it in GitHub Desktop.
extends an abstract class and implements an interface
This file contains 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 | |
interface NameInterface | |
{ | |
public function getName(); | |
} | |
abstract class ValueObject implements NameInterface | |
{ | |
protected $name; | |
public function getName() | |
{ | |
return $this->name; | |
} | |
} | |
class Concrete extends ValueObject | |
{ | |
public function setValue($value) | |
{ | |
$this->name = $value; | |
return $this; | |
} | |
} | |
$c = (new Concrete())->setValue('test name'); | |
echo $c->getName(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment