Skip to content

Instantly share code, notes, and snippets.

@zgoniaiko
Last active July 9, 2019 01:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zgoniaiko/8418d71467af17d81eb1859a476ab09d to your computer and use it in GitHub Desktop.
Save zgoniaiko/8418d71467af17d81eb1859a476ab09d to your computer and use it in GitHub Desktop.
extends an abstract class and implements an interface
<?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