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