<?php
interface Geocoder {}
interface GeocoderThatSupportsBounds {}
class Base implements Geocoder{
public function speak() { return 'Foo'; }
}
class Google extends Base implements GeocoderThatSupportsBounds {
public function speak() { return 'Bar'; }
}
// Third party library that expects a geocoder
function normalGeocode(Geocoder $foo) {
echo $foo->speak();
}
// Special geocoder
function geocodeWithBounds(GeocoderThatSupportsBounds $foo) {
echo $foo->speak();
}
$bar = new Google;
normalGeocode($bar);
geocodeWithBounds($bar);