Showing 265 of 271 total issues
The property $shipping_lastName is not named in camelCase. Open
class BraintreeForm extends Model
{
public $amount;
public $orderId;
public $paymentMethodToken;
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $shipping_region is not named in camelCase. Open
class BraintreeForm extends Model
{
public $amount;
public $orderId;
public $paymentMethodToken;
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $customer_lastName is not named in camelCase. Open
class BraintreeForm extends Model
{
public $amount;
public $orderId;
public $paymentMethodToken;
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $customer_company is not named in camelCase. Open
class BraintreeForm extends Model
{
public $amount;
public $orderId;
public $paymentMethodToken;
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $customer_website is not named in camelCase. Open
class BraintreeForm extends Model
{
public $amount;
public $orderId;
public $paymentMethodToken;
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $customer_firstName is not named in camelCase. Open
class BraintreeForm extends Model
{
public $amount;
public $orderId;
public $paymentMethodToken;
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $creditCard_expirationYear is not named in camelCase. Open
class BraintreeForm extends Model
{
public $amount;
public $orderId;
public $paymentMethodToken;
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $creditCard_cvv is not named in camelCase. Open
class BraintreeForm extends Model
{
public $amount;
public $orderId;
public $paymentMethodToken;
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $billing_countryCodeAlpha2 is not named in camelCase. Open
class BraintreeForm extends Model
{
public $amount;
public $orderId;
public $paymentMethodToken;
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $customer_fax is not named in camelCase. Open
class BraintreeForm extends Model
{
public $amount;
public $orderId;
public $paymentMethodToken;
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $billing_locality is not named in camelCase. Open
class BraintreeForm extends Model
{
public $amount;
public $orderId;
public $paymentMethodToken;
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $shipping_company is not named in camelCase. Open
class BraintreeForm extends Model
{
public $amount;
public $orderId;
public $paymentMethodToken;
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $creditCard_number is not named in camelCase. Open
class BraintreeForm extends Model
{
public $amount;
public $orderId;
public $paymentMethodToken;
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $billing_firstName is not named in camelCase. Open
class BraintreeForm extends Model
{
public $amount;
public $orderId;
public $paymentMethodToken;
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
Function setOptions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function setOptions(array $values): Braintree
{
if (!empty($values)) {
foreach ($values as $key => $value) {
if ($key === 'amount') {
- Read upRead up
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
Function getValuesFromAttributes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getValuesFromAttributes(): array
{
$values = [];
foreach ($this->attributes as $key => $val) {
if (!is_object($val) && !is_null($val) && strlen($val) > 0) {
- Read upRead up
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
The class Braintree has a coupling between objects value of 17. Consider to reduce the number of dependencies under 13. Open
class Braintree extends Component
{
public $environment = 'sandbox';
public $merchantId;
public $publicKey;
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
The method getPlanById has a boolean flag argument $allowCaching, which is a certain sign of a Single Responsibility Principle violation. Open
public 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
The method createPaymentMethod has a boolean flag argument $makeDefault, which is a certain sign of a Single Responsibility Principle violation. Open
public function createPaymentMethod($customerId, $paymentNonce, $makeDefault = false, $options = []): 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 $storeInVaultOnSuccess, 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) {
}
}