<?php
trait FooTrait {
protected $foo = 'configuration';
abstract protected function bar();
protected function doThing() {
return $this->foo;
}
}
class Foo {
use FooTrait;
protected function bar() {
}
public function thing() {
echo $this->doThing();
}
}
class Bar extends Foo {
protected $foo = 'asdf';
public function thing() {
echo $this->doThing();
}
}
$foo = new Foo();
$foo->thing();
$bar = new Bar();
$bar->thing();