CORE-POS/IS4C

View on GitHub
pos/is4c-nf/plugins/Paycards/card/CardReader.php

Summary

Maintainability
C
1 day
Test Coverage

File CardReader.php has 260 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace COREPOS\pos\plugins\Paycards\card;

use \Exeception;
Severity: Minor
Found in pos/is4c-nf/plugins/Paycards/card/CardReader.php - About 2 hrs to fix

    Function getTracks has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        private function getTracks($data)
        {
            $tr1 = false;
            $weirdTr1 = false;
            $tr2 = false;
    Severity: Minor
    Found in pos/is4c-nf/plugins/Paycards/card/CardReader.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 cardInfo has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        public function cardInfo($pan) 
        {
            $len = strlen($pan);
            $iin = (int)substr($pan,0,7);
            $issuer = "Unknown";
    Severity: Minor
    Found in pos/is4c-nf/plugins/Paycards/card/CardReader.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 cardInfo has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function cardInfo($pan) 
        {
            $len = strlen($pan);
            $iin = (int)substr($pan,0,7);
            $issuer = "Unknown";
    Severity: Minor
    Found in pos/is4c-nf/plugins/Paycards/card/CardReader.php - About 1 hr to fix

      Method magstripe has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function magstripe($data) 
          {
              // initialize
              try {
                  list($tr1, $tr2, $tr3) = $this->getTracks($data);
      Severity: Minor
      Found in pos/is4c-nf/plugins/Paycards/card/CardReader.php - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

                if ($len == 16 && substr($pan, 0, 4) == '7777') {
                    $type = PaycardLib::PAYCARD_TYPE_VALUELINK;
                    $issuer = 'ValueLink';
                    $accepted = true;
                } elseif ($len >= 13 && $len <= 16) {
        Severity: Major
        Found in pos/is4c-nf/plugins/Paycards/card/CardReader.php - About 1 hr to fix

          Function parseTrack2 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              private function parseTrack2($tr2, $tr1)
              {
                  $pan = false;
                  $exp = false;
                  $name = false;
          Severity: Minor
          Found in pos/is4c-nf/plugins/Paycards/card/CardReader.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

          Function magstripe has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function magstripe($data) 
              {
                  // initialize
                  try {
                      list($tr1, $tr2, $tr3) = $this->getTracks($data);
          Severity: Minor
          Found in pos/is4c-nf/plugins/Paycards/card/CardReader.php - About 45 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

          Function identifyBin has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              private function identifyBin($binRange, $iin, $ebtAccept)
              {
                  $accepted = true;
                  $issuer = 'Unknown';
                  foreach ($binRange as $range) {
          Severity: Minor
          Found in pos/is4c-nf/plugins/Paycards/card/CardReader.php - About 45 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