Skip to content

Instantly share code, notes, and snippets.



Last active Mar 27, 2017
What would you like to do?
// singleton
class FooApiClient
private function __construct();
public static function getInstance(): FooApiClient;
public function getBar(): Bar;
class FooApiConsumer
public function doSomethingWithBarFromFooApi(): array
// ukryta zależność:
$fooApiClient = FooApiClient::getInstance();
// jak to podmienić, żeby nie robiło prawdziwych żądań do API?
$bar = $fooApiClient->getBar();
return $bar->baz();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment