Skip to content

Instantly share code, notes, and snippets.

@lunetics
Created September 27, 2018 08:38
Show Gist options
  • Save lunetics/dbc7e383cd6f36e4678733bc670bda5e to your computer and use it in GitHub Desktop.
Save lunetics/dbc7e383cd6f36e4678733bc670bda5e to your computer and use it in GitHub Desktop.
<?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