dmitry-kulikov/yii2-braintree

View on GitHub

Showing 265 of 271 total issues

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

            'customer_firstName' => 'First Name',
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.

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

        $config = array_merge(['options' => $this->inputOptions], $config);
Severity: Minor
Found in src/ActiveField.php by phan

Class extends undeclared class \yii\bootstrap\ActiveForm (Did you mean class \tuyakhov\braintree\ActiveForm)
Open

class ActiveForm extends \yii\bootstrap\ActiveForm
Severity: Critical
Found in src/ActiveForm.php by phan

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

                ['amount', 'paymentMethodToken'],
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.

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

        $result = CreditCard::create($sendArray);
Severity: Critical
Found in src/Braintree.php by phan

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

            [['amount'], 'number'],
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.

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

            if ($plan->id === $planId) {
Severity: Minor
Found in src/Braintree.php by phan

Return type of findTransaction() is undeclared type \Braintree\Transaction
Open

    public function findTransaction(string $id): Transaction
Severity: Minor
Found in src/Braintree.php by phan

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

        return ['status' => $result->success, 'result' => $result];
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.

Class extends undeclared class \yii\bootstrap\ActiveField (Did you mean class \tuyakhov\braintree\ActiveField)
Open

class ActiveField extends \yii\bootstrap\ActiveField
Severity: Critical
Found in src/ActiveField.php by phan

Possibly zero references to public method \tuyakhov\braintree\ActiveField::widget()
Open

    public function widget($class, $config = [])
Severity: Minor
Found in src/ActiveField.php by phan

Call to method sale from undeclared class \Braintree\Transaction
Open

        $result = Transaction::sale(
Severity: Critical
Found in src/Braintree.php by phan

Return type of searchTransaction() is undeclared type \Braintree\ResourceCollection
Open

    public function searchTransaction($params = []): ResourceCollection
Severity: Minor
Found in src/Braintree.php by phan

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

        $this->options['options']['submitForSettlement'] = $submitForSettlement;
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 class \yii\bootstrap\ActiveField (Did you mean class \tuyakhov\braintree\ActiveField)
Open

        return parent::widget($class, $config);
Severity: Critical
Found in src/ActiveField.php by phan

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

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

Property \tuyakhov\braintree\Braintree->plans has undeclared type \Braintree\Plan[]
Open

    protected $plans;
Severity: Minor
Found in src/Braintree.php by phan

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

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

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

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

Assigning array<string></string> to property but \tuyakhov\braintree\Braintree->options is array<string></string>
Open

            $this->options['customer']['id'] = $this->options['customerId'];
Severity: Minor
Found in src/Braintree.php by phan
Severity
Category
Status
Source
Language