for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Loevgaard\AltaPay\Callback;
use Loevgaard\AltaPay;
use Money\Money;
class Form extends Callback
{
/**
* @var string
*/
protected $shopOrderId;
* @var Money
protected $amount;
* ISO 4217 currency code
*
* @var int
protected $currency;
* ISO 639 alpha 2 language code
protected $language;
* @var boolean
protected $embeddedWindow;
public function init()
$currency = (int)$this->body['currency'];
$alphaCurrency = AltaPay\alphaCurrencyFromNumeric($currency);
$this->shopOrderId = $this->body['shop_orderid'];
$this->amount = AltaPay\createMoneyFromFloat($alphaCurrency, (float)$this->body['amount']);
$this->currency = $currency;
$this->language = $this->body['language'];
$this->embeddedWindow = (int)($this->body['embedded_window'] === 1);
$embeddedWindow
boolean
(int) ($this->body['embedded_window'] === 1)
integer
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.
$answer = 42; $correct = false; $correct = (bool) $answer;
}
* @return string
public function getShopOrderId(): string
return $this->shopOrderId;
* @return Money
public function getAmount(): Money
return $this->amount;
* @return int
public function getCurrency(): int
return $this->currency;
public function getLanguage(): string
return $this->language;
* @return bool
public function isEmbeddedWindow(): bool
return $this->embeddedWindow;
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.