Created
September 27, 2018 08:38
-
-
Save lunetics/dbc7e383cd6f36e4678733bc670bda5e to your computer and use it in GitHub Desktop.
This file contains 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 | |
interface Price | |
{ | |
public function money(): Money; | |
public function currency(): Currency; | |
} | |
class Vat | |
{ | |
public function vatAmount(): VatAmount | |
public function vatCountry(): VatCountry | |
public function vatRate(): VatRate | |
} | |
class VatAmount implements Price | |
{ | |
public function money(): Money; | |
public function currency(): Currency; | |
} | |
// --- Considered bad practice? | |
class Vat implements Price | |
{ | |
public function money(): Money | |
{ | |
return $this->vatAmount->money(); | |
} | |
public function currency(): Currency | |
{ | |
return $this->vatAmount->currency(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment