This commit is contained in:
2022-03-29 16:08:41 +02:00
parent 5cd788c765
commit 98c6814863
4 changed files with 172 additions and 39 deletions
+59
View File
@@ -2,12 +2,49 @@
declare(strict_types=1);
namespace App\Logic\Crypto;
use phpDocumentor\Reflection\DocBlock\Tags\Var_;
class MainObject
{
private \DateTime $dateTime;
private string $desc;
private float $value;
private string $currency;
private ?string $realCurrency=null;
private float $realValue=0;
private float $price=0;
/**
* @return float
*/
public function getRealValue(): float
{
return $this->realValue;
}
/**
* @param float $realValue
*/
public function setRealValue(float $realValue): void
{
$this->realValue = $realValue;
}
/**
* @return string
*/
public function getRealCurrency(): string
{
return $this->realCurrency;
}
/**
* @param string $realCurrency
*/
public function setRealCurrency(string $realCurrency): void
{
$this->realCurrency = $realCurrency;
}
/**
* @return \DateTime
@@ -73,4 +110,26 @@ class MainObject
$this->currency = $currency;
}
public function addValue(float $val) : void
{
$this->value += $val;
}
public function addRealValue(float $val) : void
{
if (!isset($this->realValue)) {
$this->realValue = 0;
}
$this->realValue += $val;
}
public function takePrice() : void
{
$this->price = abs(round($this->realValue / $this->getValue(),4));
}
public function getPrice() : float
{
return $this->price;
}
}