shetabit/multipay

View on GitHub
src/Drivers/Atipay/Core/fn.atipay.php

Summary

Maintainability
C
1 day
Test Coverage

Function fn_atipay_get_token has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

function fn_atipay_get_token($params)
{
    $r = wsRequestPost(ATIPAY_TOKEN_URL, $params);
    $return = array();
    if ($r) {
Severity: Minor
Found in src/Drivers/Atipay/Core/fn.atipay.php - About 1 hr to fix

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 _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 "پرداخت توسط شما لغو شده است.";
Severity: Minor
Found in src/Drivers/Atipay/Core/fn.atipay.php - About 1 hr to fix

    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) {
    Severity: Minor
    Found in src/Drivers/Atipay/Core/fn.atipay.php - About 1 hr to fix

    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

    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 "پرداخت توسط شما لغو شده است.";
    Severity: Minor
    Found in src/Drivers/Atipay/Core/fn.atipay.php - About 55 mins to fix

    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

    Consider simplifying this complex logical expression.
    Open

        if (!isset($params['state']) ||
            !isset($params['status']) ||
            !isset($params['reservationNumber']) ||
            !isset($params['referenceNumber']) ||
            !isset($params['terminalId']) ||
    Severity: Major
    Found in src/Drivers/Atipay/Core/fn.atipay.php - About 40 mins to fix

      Avoid too many return statements within this method.
      Open

                  return "شماره ترمینال ارسال شده یافت نشد";
      Severity: Major
      Found in src/Drivers/Atipay/Core/fn.atipay.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return "با این شماره ترمینال فقط تراکنش هاي توکنی قابل پرداخت هستند";
        Severity: Major
        Found in src/Drivers/Atipay/Core/fn.atipay.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return "آدرس سرور پذیرنده نامعتبر است";
          Severity: Major
          Found in src/Drivers/Atipay/Core/fn.atipay.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return "خطای نامشخص در عملیات پرداخت";
            Severity: Major
            Found in src/Drivers/Atipay/Core/fn.atipay.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return "توکن ارسال شده یافت نشد";
              Severity: Major
              Found in src/Drivers/Atipay/Core/fn.atipay.php - About 30 mins to fix

                Function fn_check_callback_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                function fn_check_callback_data($params)
                {
                    $result = array();
                    if (isset($params['state']) && !empty($params['state'])) {
                        $state = $params['state'];
                Severity: Minor
                Found in src/Drivers/Atipay/Core/fn.atipay.php - About 25 mins to fix

                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

                There are no issues that match your filters.

                Category
                Status