dmitry-kulikov/yii2-braintree

View on GitHub

Showing 265 of 271 total issues

Define a constant instead of duplicating this literal "amount" 5 times.
Open

                'amount' => $amount,
Severity: Critical
Found in src/Braintree.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Call to undeclared method \tuyakhov\braintree\ActiveForm::getView
Open

        BraintreeAsset::register($this->getView());
Severity: Critical
Found in src/ActiveForm.php by phan

Possibly zero references to public property \tuyakhov\braintree\Braintree->privateKey
Open

    public $privateKey;
Severity: Minor
Found in src/Braintree.php by phan

Possibly zero references to public method \tuyakhov\braintree\Braintree::init()
Open

    public function init()
Severity: Minor
Found in src/Braintree.php by phan

Reference to instance property id from undeclared class \Braintree\Plan
Open

            $planIds[] = $plan->id;
Severity: Minor
Found in src/Braintree.php by phan

Define a constant instead of duplicating this literal "customer_lastName" 3 times.
Open

                ['customer_firstName', 'customer_lastName'],
Severity: Critical
Found in src/BraintreeForm.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "status" 13 times.
Open

        if ($result['status'] === false) {
Severity: Critical
Found in src/BraintreeForm.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "creditCard_cvv" 3 times.
Open

                ['creditCard_number', 'creditCard_expirationDate', 'creditCard_cvv', 'customerId'],
Severity: Critical
Found in src/BraintreeForm.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "creditCard_number" 6 times.
Open

                ['creditCard_number', 'creditCard_expirationDate', 'creditCard_cvv', 'customerId'],
Severity: Critical
Found in src/BraintreeForm.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "customerId" 8 times.
Open

        if (isset($this->options['customerId'])) {
Severity: Critical
Found in src/Braintree.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Possibly zero references to public method \tuyakhov\braintree\ActiveForm::init()
Open

    public function init()
Severity: Minor
Found in src/ActiveForm.php by phan

Static call to undeclared method \tuyakhov\braintree\BraintreeAsset::register
Open

        BraintreeAsset::register($this->getView());
Severity: Critical
Found in src/ActiveForm.php by phan

Possibly zero references to public property \tuyakhov\braintree\Braintree->publicKey
Open

    public $publicKey;
Severity: Minor
Found in src/Braintree.php by phan

Call to method create from undeclared class \Braintree\PaymentMethod
Open

        $result = PaymentMethod::create($this->options['paymentMethod']);
Severity: Critical
Found in src/Braintree.php by phan

Call to method create from undeclared class \Braintree\Customer
Open

        $result = Customer::create($this->options['customer']);
Severity: Critical
Found in src/Braintree.php by phan

Call to method getValue from undeclared class \yii\helpers\ArrayHelper
Open

            $optionalValue = ArrayHelper::getValue($values, $optionalParamName);
Severity: Critical
Found in src/Braintree.php by phan

Define a constant instead of duplicating this literal "required" 5 times.
Open

                'required',
Severity: Critical
Found in src/BraintreeForm.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "billing" 3 times.
Open

        if (isset($this->options['billing'])) {
Severity: Critical
Found in src/Braintree.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "creditCard" 4 times.
Open

        $sendArray = $this->options['creditCard'];
Severity: Critical
Found in src/Braintree.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Reference to undeclared property \tuyakhov\braintree\ActiveField->inputOptions
Open

            $this->inputOptions
Severity: Minor
Found in src/ActiveField.php by phan
Severity
Category
Status
Source
Language