<?php
interface Counter
{
/** @return self */
public function count();
/** @return int */
public function getCount();
}
class EchoingCounter implements Counter
{
private $counter;
public function __construct(Counter $counter)
{
$this->counter = $counter;
}
public function count()
{
echo __METHOD__ . "\n";
return $this->counter->count();
}
public function getCount()
{
echo __METHOD__ . "\n";
return $this->counter->getCount();
}
}