Last active
August 29, 2015 14:04
-
-
Save felipecwb/b7a3b3948b47ea122190 to your computer and use it in GitHub Desktop.
Some code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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