mirror of
https://github.com/kevinveenbirkenbach/coding-challenge-online-shop.git
synced 2025-09-10 03:47:13 +02:00
Implemented Euros and test
This commit is contained in:
42
src/entity/currency/Euro.php
Normal file
42
src/entity/currency/Euro.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
namespace entity\currency;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
final class Euro implements CurrencyInterface
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $cents;
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
return 'Euro';
|
||||
}
|
||||
|
||||
public function getCents(): int
|
||||
{
|
||||
return $this->cents;
|
||||
}
|
||||
|
||||
public function setCents(int $cents): void
|
||||
{
|
||||
$this->cents = $cents;
|
||||
}
|
||||
|
||||
public function getFloat(): float
|
||||
{
|
||||
return ($this->cents/100);
|
||||
}
|
||||
|
||||
public function getSymbol(): string
|
||||
{
|
||||
return '€';
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user