Showing 265 of 271 total issues
The method getPlanIds has a boolean flag argument $allowCaching, which is a certain sign of a Single Responsibility Principle violation. Open
public function getPlanIds(bool $allowCaching = true): array
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method getAllPlans has a boolean flag argument $allowCaching, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getAllPlans(bool $allowCaching = true): array
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method sale has a boolean flag argument $submitForSettlement, which is a certain sign of a Single Responsibility Principle violation. Open
public function sale(bool $submitForSettlement = true, bool $storeInVaultOnSuccess = true): array
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method getAllPlans has a boolean flag argument $allowCaching, which is a certain sign of a Single Responsibility Principle violation. Open
public function getAllPlans(bool $allowCaching = true): array
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method getPlanIds has a boolean flag argument $allowCaching, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getPlanIds(bool $allowCaching = true): array
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method getPlanById has a boolean flag argument $allowCaching, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getPlanById(string $planId, bool $allowCaching = true): ?Plan
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Define a constant instead of duplicating this literal "Last Name" 3 times. Open
'customer_lastName' => 'Last 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.
Define a constant instead of duplicating this literal "options" 3 times. Open
'options' => $options,
- 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 "result" 9 times. Open
return ['status' => $result->success, '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.
Reference to undeclared class \yii\bootstrap\ActiveField
(Did you mean class \tuyakhov\braintree\ActiveField) Open
parent::init();
- Exclude checks
Call to method merchantId
from undeclared class \Braintree\Configuration
Open
Configuration::$attribute($this->$attribute);
- Exclude checks
Assigning array<string></string>
to property but \tuyakhov\braintree\Braintree->options
is array<string>>|array<string></string></string>
Open
$this->options['amount'] = round($amount, 2);
- Exclude checks
Class "BraintreeForm" has 31 methods, which is greater than 20 authorized. Split it into smaller classes. Open
class BraintreeForm extends Model
- 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.
Possibly zero references to public method \tuyakhov\braintree\ActiveField::init()
Open
public function init()
- Exclude checks
Reference to undeclared property \tuyakhov\braintree\ActiveField->attribute
Open
$inputName = explode('_', $this->attribute);
- Exclude checks
Class extends undeclared class \yii\base\Component
Open
class Braintree extends Component
- Exclude checks
Possibly zero references to public property \tuyakhov\braintree\Braintree->environment
Open
public $environment = 'sandbox';
- Exclude checks
Assigning array<string></string>
to property but \tuyakhov\braintree\Braintree->options
is array<string></string>
Open
$this->options['options']['storeInVaultOnSuccess'] = $storeInVaultOnSuccess;
- Exclude checks
Call to method sale
from undeclared class \Braintree\Transaction
Open
$result = Transaction::sale($this->options);
- Exclude checks
Return type of getAllPlans()
is undeclared type \Braintree\Plan[]
Open
public function getAllPlans(bool $allowCaching = true): array
- Exclude checks