Created
December 31, 2018 01:34
-
-
Save joaorobertopb/712eda3e1598eeeeb1f3449532fac1e4 to your computer and use it in GitHub Desktop.
Aplicação do princípio de responsabilidade única do SOLID.
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 | |
class Order | |
{ | |
public function calculateTotalSum(){/*...*/} | |
public function getItems(){/*...*/} | |
public function getItemCount(){/*...*/} | |
public function addItem($item){/*...*/} | |
public function deleteItem($item){/*...*/} | |
} | |
class OrderRepository | |
{ | |
public function load($orderID){/*...*/} | |
public function save($order){/*...*/} | |
public function update($order){/*...*/} | |
public function delete($order){/*...*/} | |
} | |
class OrderViewer | |
{ | |
public function printOrder($order){/*...*/} | |
public function showOrder($order){/*...*/} | |
} | |
//Reference: https://www.apphp.com/tutorials/index.php?page=solid-principles-in-php-examples |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment