Skip to content

Instantly share code, notes, and snippets.

@felipecwb
Last active August 29, 2015 14:04
Show Gist options
  • Save felipecwb/b7a3b3948b47ea122190 to your computer and use it in GitHub Desktop.
Save felipecwb/b7a3b3948b47ea122190 to your computer and use it in GitHub Desktop.
Some code
<?php
namespace felipecwb\Something;
interface Storage {
public function persist($data);
public function delete($data);
public function getById($id);
}
class RelationalStorage implements Storage {
// implements
}
class GraphStorage implements Storage {
// implements
}
class FileStorage implements Storage {
// implements
}
class ProductStorageService implements Storage {
private $api;
public function __construct(Storage $api) {
$this->api = $api;
}
public function persist(Product $product) {
$this->api->persist($product);
}
public function delete(Product $product) {
$this->api->delete($product);
}
public function getById($id) {
$this->api->getById($id);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment