test string val
This commit is contained in:
@@ -25,6 +25,8 @@ class Crypto extends Main
|
||||
if ($item->getValue() == 0) {
|
||||
continue;
|
||||
}
|
||||
if ($item->getCurrency() === "BTC")
|
||||
dd($item,$item->getValueCrypto());
|
||||
// if (!isset($sum[$item->getCurrency()])) {
|
||||
// $sum[$item->getCurrency()] = [];
|
||||
// if (!isset($sum[$item->getCurrency()][$item->getDateTime()->format("Y-m-d")])){
|
||||
|
||||
@@ -40,12 +40,10 @@ class Main
|
||||
$obj = new MainObject();
|
||||
foreach ($names as $key => $name) {
|
||||
if ($name === "setValue") {
|
||||
// if ($datum[$key]!=="0,00") dd();
|
||||
$data = $datum[$key];
|
||||
if (is_string($data)) {
|
||||
$data = strtr($data,",",".");
|
||||
}
|
||||
$datum[$key] = floatval($data);
|
||||
$data = "$datum[$key]";
|
||||
$data = str_replace(",","",$data);
|
||||
$data = str_replace(".","",$data);
|
||||
$datum[$key] = $data;
|
||||
}
|
||||
if ($name === "setDateTime") {
|
||||
$datum[$key] = new \DateTime($datum[$key]);
|
||||
|
||||
@@ -8,7 +8,7 @@ class MainObject
|
||||
{
|
||||
private \DateTime $dateTime;
|
||||
private string $desc;
|
||||
private float $value;
|
||||
private string $value;
|
||||
private string $currency;
|
||||
private ?string $realCurrency=null;
|
||||
private float $realValue=0;
|
||||
@@ -79,17 +79,17 @@ class MainObject
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
* @return int
|
||||
*/
|
||||
public function getValue(): float
|
||||
public function getValue(): string
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $value
|
||||
* @param int $value
|
||||
*/
|
||||
public function setValue(float $value): void
|
||||
public function setValue(string $value): void
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
@@ -110,7 +110,7 @@ class MainObject
|
||||
$this->currency = $currency;
|
||||
}
|
||||
|
||||
public function addValue(float $val) : void
|
||||
public function addValue(int $val) : void
|
||||
{
|
||||
$this->value += $val;
|
||||
}
|
||||
@@ -132,4 +132,9 @@ class MainObject
|
||||
{
|
||||
return $this->price;
|
||||
}
|
||||
|
||||
public function getValueCrypto() : float
|
||||
{
|
||||
return intval($this->value) / 100000000;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user