Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct($PelecardStatusCode, $PelecardTransactionId, $ParamX, $UserKey, $ConfirmationKey, $TotalX100, $ApprovalNo = '', $Token = '') {
This function has 8 parameters, which is greater than the 7 authorized. Open
public function __construct($PelecardStatusCode, $PelecardTransactionId, $ParamX, $UserKey, $ConfirmationKey, $TotalX100, $ApprovalNo = '', $Token = '') {
- Read upRead up
- Exclude checks
A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.
Noncompliant Code Example
With a maximum number of 4 parameters:
function doSomething($param1, $param2, $param3, $param4, $param5) { ... }
Compliant Solution
function doSomething($param1, $param2, $param3, $param4) { ... }
Saw an @param annotation for UniqueKey,
but it was not found in the param list of function __construct($PelecardStatusCode, $PelecardTransactionId, $ParamX, $UserKey, $ConfirmationKey, $TotalX100, mixed|string $ApprovalNo = '', mixed|string $Token = '')
Open
* @param $UniqueKey
- Exclude checks
Expected @param annotation for TotalX100
to be before the @param annotation for ApprovalNo
Open
* @param $ApprovalNo
- Exclude checks
Avoid excessively long variable names like $PelecardTransactionId. Keep variable name length under 20. Open
protected $PelecardTransactionId;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $PelecardTransactionId. Keep variable name length under 20. Open
public function __construct($PelecardStatusCode, $PelecardTransactionId, $ParamX, $UserKey, $ConfirmationKey, $TotalX100, $ApprovalNo = '', $Token = '') {
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $USER_INPUT_ERROR_CODES. Keep variable name length under 20. Open
public static $USER_INPUT_ERROR_CODES = ['006', '033', '036'];
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
The property $USER_INPUT_ERROR_CODES is not named in camelCase. Open
class PaymentResponse implements \JsonSerializable {
protected $PelecardStatusCode;
protected $PelecardTransactionId;
protected $ApprovalNo;
- 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 parameter $Token is not named in camelCase. Open
public function __construct($PelecardStatusCode, $PelecardTransactionId, $ParamX, $UserKey, $ConfirmationKey, $TotalX100, $ApprovalNo = '', $Token = '') {
$this->PelecardStatusCode = $PelecardStatusCode;
$this->PelecardTransactionId = $PelecardTransactionId;
$this->ApprovalNo = $ApprovalNo;
$this->Token = $Token;
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $ConfirmationKey is not named in camelCase. Open
public function __construct($PelecardStatusCode, $PelecardTransactionId, $ParamX, $UserKey, $ConfirmationKey, $TotalX100, $ApprovalNo = '', $Token = '') {
$this->PelecardStatusCode = $PelecardStatusCode;
$this->PelecardTransactionId = $PelecardTransactionId;
$this->ApprovalNo = $ApprovalNo;
$this->Token = $Token;
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $ParamX is not named in camelCase. Open
public function __construct($PelecardStatusCode, $PelecardTransactionId, $ParamX, $UserKey, $ConfirmationKey, $TotalX100, $ApprovalNo = '', $Token = '') {
$this->PelecardStatusCode = $PelecardStatusCode;
$this->PelecardTransactionId = $PelecardTransactionId;
$this->ApprovalNo = $ApprovalNo;
$this->Token = $Token;
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $PelecardTransactionId is not named in camelCase. Open
public function __construct($PelecardStatusCode, $PelecardTransactionId, $ParamX, $UserKey, $ConfirmationKey, $TotalX100, $ApprovalNo = '', $Token = '') {
$this->PelecardStatusCode = $PelecardStatusCode;
$this->PelecardTransactionId = $PelecardTransactionId;
$this->ApprovalNo = $ApprovalNo;
$this->Token = $Token;
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $TotalX100 is not named in camelCase. Open
public function __construct($PelecardStatusCode, $PelecardTransactionId, $ParamX, $UserKey, $ConfirmationKey, $TotalX100, $ApprovalNo = '', $Token = '') {
$this->PelecardStatusCode = $PelecardStatusCode;
$this->PelecardTransactionId = $PelecardTransactionId;
$this->ApprovalNo = $ApprovalNo;
$this->Token = $Token;
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $PelecardStatusCode is not named in camelCase. Open
public function __construct($PelecardStatusCode, $PelecardTransactionId, $ParamX, $UserKey, $ConfirmationKey, $TotalX100, $ApprovalNo = '', $Token = '') {
$this->PelecardStatusCode = $PelecardStatusCode;
$this->PelecardTransactionId = $PelecardTransactionId;
$this->ApprovalNo = $ApprovalNo;
$this->Token = $Token;
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $UserKey is not named in camelCase. Open
public function __construct($PelecardStatusCode, $PelecardTransactionId, $ParamX, $UserKey, $ConfirmationKey, $TotalX100, $ApprovalNo = '', $Token = '') {
$this->PelecardStatusCode = $PelecardStatusCode;
$this->PelecardTransactionId = $PelecardTransactionId;
$this->ApprovalNo = $ApprovalNo;
$this->Token = $Token;
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $ApprovalNo is not named in camelCase. Open
public function __construct($PelecardStatusCode, $PelecardTransactionId, $ParamX, $UserKey, $ConfirmationKey, $TotalX100, $ApprovalNo = '', $Token = '') {
$this->PelecardStatusCode = $PelecardStatusCode;
$this->PelecardTransactionId = $PelecardTransactionId;
$this->ApprovalNo = $ApprovalNo;
$this->Token = $Token;
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
Opening brace of a class must be on the line after the definition Open
class PaymentResponse implements \JsonSerializable {
- Exclude checks
The closing brace for the class must go on the next line after the body Open
}
- Exclude checks
Line exceeds 120 characters; contains 156 characters Open
public function __construct($PelecardStatusCode, $PelecardTransactionId, $ParamX, $UserKey, $ConfirmationKey, $TotalX100, $ApprovalNo = '', $Token = '') {
- Exclude checks
Line exceeds 120 characters; contains 151 characters Open
'UniqueKey' => !empty($this->UserKey) ? $this->UserKey : $this->PelecardTransactionId, // Send the UserKey if given, otherwise the transaction ID
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
$this->UserKey = $UserKey;
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
$this->PelecardStatusCode = $PelecardStatusCode;
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
protected $TotalX100;
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
}
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
$this->ParamX = $ParamX;
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
public function getPelecardStatusCode() {
- Exclude checks
Opening brace should be on a new line Open
public function __construct($PelecardStatusCode, $PelecardTransactionId, $ParamX, $UserKey, $ConfirmationKey, $TotalX100, $ApprovalNo = '', $Token = '') {
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
return $this->PelecardTransactionId;
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
protected $PelecardStatusCode;
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
$this->PelecardTransactionId = $PelecardTransactionId;
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
$this->ApprovalNo = $ApprovalNo;
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 2 Open
const TIMEOUT_ERROR_CODE = '301';
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
}
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
$this->ConfirmationKey = $ConfirmationKey;
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 6 Open
'ConfirmationKey' => $this->ConfirmationKey,
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 6 Open
'UniqueKey' => !empty($this->UserKey) ? $this->UserKey : $this->PelecardTransactionId, // Send the UserKey if given, otherwise the transaction ID
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
protected $PelecardTransactionId;
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
public static $USER_INPUT_ERROR_CODES = ['006', '033', '036'];
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
$this->TotalX100 = $TotalX100;
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
return $this->PelecardStatusCode;
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
protected $Token;
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
public function getPelecardTransactionId() {
- Exclude checks
Opening brace should be on a new line Open
public function getPelecardTransactionId() {
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
return [
- Exclude checks
Opening brace should be on a new line Open
public function getValidationRequestStruct() {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
protected $ConfirmationKey;
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
$this->Token = $Token;
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
protected $ParamX;
- Exclude checks
Opening brace should be on a new line Open
public function getPelecardStatusCode() {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
public function getValidationRequestStruct() {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
}
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
protected $UserKey;
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
public function __construct($PelecardStatusCode, $PelecardTransactionId, $ParamX, $UserKey, $ConfirmationKey, $TotalX100, $ApprovalNo = '', $Token = '') {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
protected $ApprovalNo;
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
}
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
public function isStatusSuccess() {
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
return get_object_vars($this);
- Exclude checks
Opening brace should be on a new line Open
public static function isTimeoutErrorCode($errorCode) {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
public function isTimeoutError() {
- Exclude checks
Opening brace should be on a new line Open
public function isRetriesAllowed() {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
public static function isUserInputErrorByCode($errorCode) {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
}
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 6 Open
'TotalX100' => $this->TotalX100
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
];
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
return ($errorCode == self::TIMEOUT_ERROR_CODE);
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
public function isRetriesAllowed() {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
}
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
public static function isTimeoutErrorCode($errorCode) {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
}
- Exclude checks
Opening brace should be on a new line Open
public function isStatusSuccess() {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
public function jsonSerialize() {
- Exclude checks
Opening brace should be on a new line Open
public function jsonSerialize() {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
}
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
return static::isTimeoutErrorCode($this->PelecardStatusCode);
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
}
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
private function isUserInputError() {
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
return static::isUserInputErrorByCode($this->PelecardStatusCode);
- Exclude checks
Opening brace should be on a new line Open
private function isUserInputError() {
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
return in_array($errorCode, self::$USER_INPUT_ERROR_CODES);
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
}
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
return ($this->PelecardStatusCode != '000' && !$this->isUserInputError() && !$this->isTimeoutError());
- Exclude checks
Opening brace should be on a new line Open
public static function isUserInputErrorByCode($errorCode) {
- Exclude checks
Line indented incorrectly; expected at least 8 spaces, found 4 Open
return ($this->PelecardStatusCode == '000');
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
}
- Exclude checks
Opening brace should be on a new line Open
public function isTimeoutError() {
- Exclude checks
The variable $PelecardStatusCode is not named in camelCase. Open
public function __construct($PelecardStatusCode, $PelecardTransactionId, $ParamX, $UserKey, $ConfirmationKey, $TotalX100, $ApprovalNo = '', $Token = '') {
$this->PelecardStatusCode = $PelecardStatusCode;
$this->PelecardTransactionId = $PelecardTransactionId;
$this->ApprovalNo = $ApprovalNo;
$this->Token = $Token;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $PelecardTransactionId is not named in camelCase. Open
public function __construct($PelecardStatusCode, $PelecardTransactionId, $ParamX, $UserKey, $ConfirmationKey, $TotalX100, $ApprovalNo = '', $Token = '') {
$this->PelecardStatusCode = $PelecardStatusCode;
$this->PelecardTransactionId = $PelecardTransactionId;
$this->ApprovalNo = $ApprovalNo;
$this->Token = $Token;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $Token is not named in camelCase. Open
public function __construct($PelecardStatusCode, $PelecardTransactionId, $ParamX, $UserKey, $ConfirmationKey, $TotalX100, $ApprovalNo = '', $Token = '') {
$this->PelecardStatusCode = $PelecardStatusCode;
$this->PelecardTransactionId = $PelecardTransactionId;
$this->ApprovalNo = $ApprovalNo;
$this->Token = $Token;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $ApprovalNo is not named in camelCase. Open
public function __construct($PelecardStatusCode, $PelecardTransactionId, $ParamX, $UserKey, $ConfirmationKey, $TotalX100, $ApprovalNo = '', $Token = '') {
$this->PelecardStatusCode = $PelecardStatusCode;
$this->PelecardTransactionId = $PelecardTransactionId;
$this->ApprovalNo = $ApprovalNo;
$this->Token = $Token;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $UserKey is not named in camelCase. Open
public function __construct($PelecardStatusCode, $PelecardTransactionId, $ParamX, $UserKey, $ConfirmationKey, $TotalX100, $ApprovalNo = '', $Token = '') {
$this->PelecardStatusCode = $PelecardStatusCode;
$this->PelecardTransactionId = $PelecardTransactionId;
$this->ApprovalNo = $ApprovalNo;
$this->Token = $Token;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $ParamX is not named in camelCase. Open
public function __construct($PelecardStatusCode, $PelecardTransactionId, $ParamX, $UserKey, $ConfirmationKey, $TotalX100, $ApprovalNo = '', $Token = '') {
$this->PelecardStatusCode = $PelecardStatusCode;
$this->PelecardTransactionId = $PelecardTransactionId;
$this->ApprovalNo = $ApprovalNo;
$this->Token = $Token;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $ConfirmationKey is not named in camelCase. Open
public function __construct($PelecardStatusCode, $PelecardTransactionId, $ParamX, $UserKey, $ConfirmationKey, $TotalX100, $ApprovalNo = '', $Token = '') {
$this->PelecardStatusCode = $PelecardStatusCode;
$this->PelecardTransactionId = $PelecardTransactionId;
$this->ApprovalNo = $ApprovalNo;
$this->Token = $Token;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $TotalX100 is not named in camelCase. Open
public function __construct($PelecardStatusCode, $PelecardTransactionId, $ParamX, $UserKey, $ConfirmationKey, $TotalX100, $ApprovalNo = '', $Token = '') {
$this->PelecardStatusCode = $PelecardStatusCode;
$this->PelecardTransactionId = $PelecardTransactionId;
$this->ApprovalNo = $ApprovalNo;
$this->Token = $Token;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}