crypto
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user