shetabit/multipay

View on GitHub

Showing 91 of 108 total issues

Function notVerified has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    private function notVerified($status, $method)
    {
        $message = "";
        if ($method == 'token') {
            switch ($status) {
Severity: Minor
Found in src/Drivers/Rayanpay/Rayanpay.php - About 3 hrs 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 purchase has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function purchase()
    {
        $terminalId = $this->settings->terminalId;
        $orderId = crc32($this->invoice->getUuid());
        $amount = $this->invoice->getAmount() * ($this->settings->currency == 'T' ? 10 : 1); // convert to rial
Severity: Major
Found in src/Drivers/Sadad/Sadad.php - About 2 hrs to fix

    Method notVerified has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function notVerified($status, $method)
        {
            $message = "";
            if ($method == 'token') {
                switch ($status) {
    Severity: Major
    Found in src/Drivers/Rayanpay/Rayanpay.php - About 2 hrs to fix

      Method notVerified has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function notVerified($status)
          {
              $translations = [
                  5 => 'از انجام تراکنش صرف نظر شد',
                  17 => 'از انجام تراکنش صرف نظر شد',
      Severity: Major
      Found in src/Drivers/Irankish/Irankish.php - About 2 hrs to fix

        Method translateStatusCode has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function translateStatusCode($code): string
            {
                $translations = [
                    0 => 'پرداخت تکمیل و با موفقیت انجام شده است',
                    -1 => 'منتظر ارسال تراکنش و ادامه پرداخت',
        Severity: Major
        Found in src/Drivers/Nextpay/Nextpay.php - About 2 hrs to fix

          Function verify has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

              public function verify() : ReceiptInterface
              {
                  $successFlag = Request::input('success');
                  $status = Request::input('status');
                  $orderId = Request::input('orderId');
          Severity: Minor
          Found in src/Drivers/Zibal/Zibal.php - About 2 hrs 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 purchase has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              public function purchase()
              {
                  $terminalId = $this->settings->terminalId;
                  $orderId = crc32($this->invoice->getUuid());
                  $amount = $this->invoice->getAmount() * ($this->settings->currency == 'T' ? 10 : 1); // convert to rial
          Severity: Minor
          Found in src/Drivers/Sadad/Sadad.php - About 2 hrs 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 purchase has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function purchase()
              {
                  $details = $this->invoice->getDetails();
          
                  $phone = null;
          Severity: Major
          Found in src/Drivers/Idpay/Idpay.php - About 2 hrs to fix

            Method translateStatus has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function translateStatus($status)
                {
                    $translations = [
                        '0' => 'تراکنش با موفقیت انجام شد',
                        '3' => 'پذيرنده کارت فعال نیست لطفا با بخش امور پذيرندگان، تماس حاصل فرمائید',
            Severity: Major
            Found in src/Drivers/Sadad/Sadad.php - About 2 hrs to fix

              Method translateStatus has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function translateStatus($status)
                  {
                      $translations = [
                          '0' => 'تراکنش با موفقیت انجام شد',
                          '11' => 'شماره کارت نامعتبر است',
              Severity: Minor
              Found in src/Drivers/Behpardakht/Behpardakht.php - About 2 hrs to fix

                Method verify has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function verify() : ReceiptInterface
                    {
                        $successFlag = Request::input('success');
                        $status = Request::input('status');
                        $orderId = Request::input('orderId');
                Severity: Minor
                Found in src/Drivers/Zibal/Zibal.php - About 1 hr to fix

                  Method translateStatus has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function translateStatus($status): string
                      {
                          $translations = [
                              'erSucceed' => 'سرویس با موفقیت اجراء شد.',
                              'erAAS_UseridOrPassIsRequired' => 'کد کاربری و رمز الزامی هست.',
                  Severity: Minor
                  Found in src/Drivers/Omidpay/Omidpay.php - About 1 hr to fix

                    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 purchaseFailed has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function purchaseFailed($status)
                        {
                            $translations = [
                                400 => "bad request",
                                401 => "unauthorized. probably wrong or unsent header(s)",
                    Severity: Minor
                    Found in src/Drivers/Asanpardakht/Asanpardakht.php - About 1 hr to fix

                      Method purchase has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function purchase(): string
                          {
                              $phone = $this->invoice->getDetail('phone')
                                  ?? $this->invoice->getDetail('cellphone')
                                  ?? $this->invoice->getDetail('mobile');
                      Severity: Minor
                      Found in src/Drivers/Digipay/Digipay.php - About 1 hr to fix

                        Method purchase has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function purchase()
                            {
                                $this->auth();
                        
                                $details = $this->invoice->getDetails();
                        Severity: Minor
                        Found in src/Drivers/Rayanpay/Rayanpay.php - About 1 hr to fix

                          Method verify has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function verify(): ReceiptInterface
                              {
                                  $resCode = Request::input('ResCode');
                                  if ($resCode != '0') {
                                      throw new InvalidPaymentException($this->translateStatus($resCode), $resCode);
                          Severity: Minor
                          Found in src/Drivers/Behpardakht/Behpardakht.php - About 1 hr to fix

                            Method purchase has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function purchase()
                                {
                                    if (!empty($this->invoice->getDetails()['description'])) {
                                        $description = $this->invoice->getDetails()['description'];
                                    } else {
                            Severity: Minor
                            Found in src/Drivers/Irankish/Irankish.php - About 1 hr to fix

                              Method purchase has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function purchase()
                                  {
                                      $data = [
                                          'api_key' => $this->settings->merchantId,
                                          'order_id' => intval(1, time()) . crc32($this->invoice->getUuid()),
                              Severity: Minor
                              Found in src/Drivers/Nextpay/Nextpay.php - About 1 hr to fix

                                Method purchase has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function purchase()
                                    {
                                        $metadata = [];
                                
                                        if (!empty($this->invoice->getDetails()['description'])) {
                                Severity: Minor
                                Found in src/Drivers/Zarinpal/Strategies/Normal.php - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language