Showing 87 of 98 total issues
Method verify
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function verify(): ReceiptInterface
{
$authority = $this->invoice->getTransactionId() ?? Request::input('authority');
$data = [
'merchant' => $this->settings->merchantId,
Method purchase
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function purchase()
{
$data = array(
'action' => 'token',
'TerminalId' => $this->settings->terminalId,
Method powMod
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function powMod($p, $q, $r)
{
$factors = array();
$div = $q;
$power_of_two = 0;
Method purchase
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function purchase()
{
$data = array(
'MID' => $this->settings->merchantId,
'ResNum' => $this->invoice->getUuid(),
Method _fn_return_state_text
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _fn_return_state_text($state)
{
switch ($state) {
case "CanceledByUser":
return "پرداخت توسط شما لغو شده است.";
Method verify
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function verify(): ReceiptInterface
{
$data = array(
'RefNum' => Request::input('RefNum'),
'merchantId' => $this->settings->merchantId,
Method purchase
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function purchase()
{
$client = new SoapClient($this->settings->apiPurchaseUrl, array('trace' => true));
$data = new stdClass();
Function fn_atipay_verify_payment
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function fn_atipay_verify_payment($params, $amount)
{
$r = wsRequestPost(ATIPAY_VERIFY_URL, $params);
$return = array();
if ($r) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method verify
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function verify(): ReceiptInterface
{
$token = $this->invoice->getTransactionId() ?? Request::input('token');
$refNum = Request::input('RefNum');
Method purchase
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function purchase()
{
$mobile = $this->extractDetails('mobile');
$cardNumber = $this->extractDetails('cardNumber');
Method verify
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function verify(): ReceiptInterface
{
$params = $_POST;
$result = fn_check_callback_data($params);
$payment_id = $params['reservationNumber'];
Method verify
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function verify() : ReceiptInterface
{
$status = Request::input('responseCode');
if (Request::input('responseCode') != "00") {
return $this->notVerified($status);
Method purchaseFailed
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function purchaseFailed($status)
{
$translations = [
"1" => "Internal Server Error",
"2" => "Resource Not Found",
Method purchase
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function purchase()
{
$details = $this->invoice->getDetails();
$amount = $this->invoice->getAmount() * ($this->settings->currency == 'T' ? 10 : 1); // convert to rial
Method purchase
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function purchase()
{
$data = [
'pin' => $this->settings->mode === "normal" ? $this->settings->pin : "sandbox",
'amount' => $this->invoice->getAmount() / ($this->settings->currency == 'T' ? 1 : 10), // convert to toman
Method verify
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function verify(): ReceiptInterface
{
$transaction_amount = Request::input('transactionAmount');
$amount = $this->invoice->getAmount() * ($this->settings->currency == 'T' ? 10 : 1); // convert to rial
Method purchase
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function purchase()
{
$mobile = $this->extractDetails('mobile');
$description = $this->extractDetails('description');
$validCardNumber = $this->extractDetails('validCardNumber');
Function _fn_return_state_text
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function _fn_return_state_text($state)
{
switch ($state) {
case "CanceledByUser":
return "پرداخت توسط شما لغو شده است.";
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method paymentRequest
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public function paymentRequest($amount, $referenceNumber, $userIdentifier, $callbackUrl, $currency = 'IRR', $description = null, $additionalData = null)
Function verify
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function verify(): ReceiptInterface
{
$resCode = Request::input('ResCode');
if ($resCode != '0') {
throw new InvalidPaymentException($this->translateStatus($resCode), $resCode);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"