Showing 265 of 271 total issues
Return type of getPlanById()
is undeclared type ?\Braintree\Plan
Open
public function getPlanById(string $planId, bool $allowCaching = true): ?Plan
- Exclude checks
Possibly zero references to class \tuyakhov\braintree\ActiveForm
Open
class ActiveForm extends \yii\bootstrap\ActiveForm
- Exclude checks
Call to method __construct
from undeclared class \yii\base\InvalidConfigException
Open
throw new InvalidConfigException(
- Exclude checks
Call to method delete
from undeclared class \Braintree\PaymentMethod
Open
$result = PaymentMethod::delete($this->options['paymentMethodToken']);
- Exclude checks
Define a constant instead of duplicating this literal "customerId" 4 times. Open
['customerId'],
- Read upRead up
- Exclude checks
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 "Company Name" 3 times. Open
'customer_company' => 'Company Name',
- Read upRead up
- Exclude checks
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\base\Component
Open
parent::init();
- Exclude checks
Call to method create
from undeclared class \Braintree\Address
Open
$result = Address::create($sendArray);
- Exclude checks
Define a constant instead of duplicating this literal "customer_firstName" 3 times. Open
['customer_firstName', 'customer_lastName'],
- Read upRead up
- Exclude checks
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_expirationDate" 4 times. Open
['creditCard_number', 'creditCard_expirationDate', 'creditCard_cvv', 'customerId'],
- Read upRead up
- Exclude checks
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\ActiveForm->fieldClass
Open
$this->fieldClass = ActiveField::class;
- Exclude checks
@throws type of init
has undeclared type \yii\base\InvalidConfigException
Open
public function init()
- Exclude checks
Reference to undeclared property \tuyakhov\braintree\ActiveField->inputOptions
Open
$this->inputOptions = array_merge(
- Exclude checks
Reference to undeclared class \yii\bootstrap\ActiveForm
(Did you mean class \tuyakhov\braintree\ActiveForm) Open
parent::init();
- Exclude checks
Define a constant instead of duplicating this literal "result" 14 times. Open
$this->addErrorFromResponse($result['result']);
- Read upRead up
- Exclude checks
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 generate
from undeclared class \Braintree\ClientToken
Open
$this->clientToken = ClientToken::generate($params);
- Exclude checks
Call to method sale
from undeclared class \Braintree\Transaction
Open
$result = Transaction::sale(
- Exclude checks
Call to method all
from undeclared class \Braintree\Plan
Open
$this->plans = Plan::all();
- Exclude checks
Class "Braintree" has 29 methods, which is greater than 20 authorized. Split it into smaller classes. Open
class Braintree extends Component
- Read upRead up
- Exclude checks
A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.
Call to method underscore
from undeclared class \yii\helpers\Inflector
Open
'data-braintree-name' => Inflector::underscore($inputName[0]),
- Exclude checks