dmitry-kulikov/yii2-braintree

View on GitHub

Showing 265 of 271 total issues

File BraintreeForm.php has 397 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * @author Anton Tuyakhov <atuyakhov@gmail.com>
 */
Severity: Minor
Found in src/BraintreeForm.php - About 5 hrs to fix

    BraintreeForm has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class BraintreeForm extends Model
    {
        public $amount;
        public $orderId;
        public $paymentMethodToken;
    Severity: Minor
    Found in src/BraintreeForm.php - About 3 hrs to fix

      Braintree has 29 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Braintree extends Component
      {
          public $environment = 'sandbox';
          public $merchantId;
          public $publicKey;
      Severity: Minor
      Found in src/Braintree.php - About 3 hrs to fix

        The class BraintreeForm has an overall complexity of 55 which is very high. The configured complexity threshold is 50.
        Open

        class BraintreeForm extends Model
        {
            public $amount;
            public $orderId;
            public $paymentMethodToken;
        Severity: Minor
        Found in src/BraintreeForm.php by phpmd

        The class Braintree has 21 public methods. Consider refactoring Braintree to keep number of public methods under 10.
        Open

        class Braintree extends Component
        {
            public $environment = 'sandbox';
            public $merchantId;
            public $publicKey;
        Severity: Minor
        Found in src/Braintree.php by phpmd

        TooManyPublicMethods

        Since: 0.1

        A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

        By default it ignores methods starting with 'get' or 'set'.

        Example

        Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

        The class BraintreeForm has 26 non-getter- and setter-methods. Consider refactoring BraintreeForm to keep number of methods under 25.
        Open

        class BraintreeForm extends Model
        {
            public $amount;
            public $orderId;
            public $paymentMethodToken;
        Severity: Minor
        Found in src/BraintreeForm.php by phpmd

        TooManyMethods

        Since: 0.1

        A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

        By default it ignores methods starting with 'get' or 'set'.

        The default was changed from 10 to 25 in PHPMD 2.3.

        Example

        Source https://phpmd.org/rules/codesize.html#toomanymethods

        The class BraintreeForm has 25 public methods. Consider refactoring BraintreeForm to keep number of public methods under 10.
        Open

        class BraintreeForm extends Model
        {
            public $amount;
            public $orderId;
            public $paymentMethodToken;
        Severity: Minor
        Found in src/BraintreeForm.php by phpmd

        TooManyPublicMethods

        Since: 0.1

        A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

        By default it ignores methods starting with 'get' or 'set'.

        Example

        Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

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

            public function rules(): array
            {
                return [
                    [['amount'], 'number'],
        
        
        Severity: Major
        Found in src/BraintreeForm.php - About 2 hrs to fix

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

              public function addErrorFromResponse(Error $result)
              {
                  $this->lastError = $result;
                  $errors = $result->errors;
                  foreach ($errors->shallowAll() as $error) {
          Severity: Minor
          Found in src/BraintreeForm.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

          Avoid excessively long variable names like $billing_streetAddress. Keep variable name length under 20.
          Open

              public $billing_streetAddress;
          Severity: Minor
          Found in src/BraintreeForm.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#longvariable

          Avoid excessively long variable names like $shipping_countryCodeAlpha2. Keep variable name length under 20.
          Open

              public $shipping_countryCodeAlpha2;
          Severity: Minor
          Found in src/BraintreeForm.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#longvariable

          Avoid excessively long variable names like $creditCard_cardholderName. Keep variable name length under 20.
          Open

              public $creditCard_cardholderName;
          Severity: Minor
          Found in src/BraintreeForm.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#longvariable

          Avoid excessively long variable names like $creditCard_expirationYear. Keep variable name length under 20.
          Open

              public $creditCard_expirationYear;
          Severity: Minor
          Found in src/BraintreeForm.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#longvariable

          Avoid excessively long variable names like $storeInVaultOnSuccess. Keep variable name length under 20.
          Open

              public function sale(bool $submitForSettlement = true, bool $storeInVaultOnSuccess = true): array
          Severity: Minor
          Found in src/Braintree.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#longvariable

          Avoid excessively long variable names like $shipping_streetAddress. Keep variable name length under 20.
          Open

              public $shipping_streetAddress;
          Severity: Minor
          Found in src/BraintreeForm.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#longvariable

          Avoid excessively long variable names like $creditCard_expirationMonth. Keep variable name length under 20.
          Open

              public $creditCard_expirationMonth;
          Severity: Minor
          Found in src/BraintreeForm.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#longvariable

          Avoid excessively long variable names like $creditCard_expirationDate. Keep variable name length under 20.
          Open

              public $creditCard_expirationDate;
          Severity: Minor
          Found in src/BraintreeForm.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#longvariable

          Avoid excessively long variable names like $billing_countryCodeAlpha2. Keep variable name length under 20.
          Open

              public $billing_countryCodeAlpha2;
          Severity: Minor
          Found in src/BraintreeForm.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#longvariable

          Avoid excessively long variable names like $shipping_extendedAddress. Keep variable name length under 20.
          Open

              public $shipping_extendedAddress;
          Severity: Minor
          Found in src/BraintreeForm.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#longvariable

          Avoid excessively long variable names like $billing_extendedAddress. Keep variable name length under 20.
          Open

              public $billing_extendedAddress;
          Severity: Minor
          Found in src/BraintreeForm.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#longvariable

          Severity
          Category
          Status
          Source
          Language