dofinity/pelecard

View on GitHub
src/Pelecard/PelecardPayment.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid using static access to class 'Pelecard\PelecardHttpRequest' in method 'SubmitPaymentRequest'.
Open

    return PelecardHttpRequest::pelecardPostRequest(self::PAYMENT_INIT_URI, $this->PaymentRequest);
Severity: Minor
Found in src/Pelecard/PelecardPayment.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Pelecard\PelecardHttpRequest' in method 'ValidatePayment'.
Open

    return !empty(PelecardHttpRequest::pelecardPostRequest(self::PAYMENT_VALIDATE_URI, $this->PaymentResponse->getValidationRequestStruct())) ? TRUE : FALSE;
Severity: Minor
Found in src/Pelecard/PelecardPayment.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Returning type false but ValidatePayment() is declared to return string
Open

    return !empty(PelecardHttpRequest::pelecardPostRequest(self::PAYMENT_VALIDATE_URI, $this->PaymentResponse->getValidationRequestStruct())) ? TRUE : FALSE;
Severity: Minor
Found in src/Pelecard/PelecardPayment.php by phan

Saw an @param annotation for PaymentRequest, but it was not found in the param list of function setPaymentResponse($PaymentResponse)
Open

   * @param \Pelecard\PaymentRespnse $PaymentRequest
Severity: Info
Found in src/Pelecard/PelecardPayment.php by phan

Saw unextractable annotation for comment '* @return: {"URL":"https://gateway20.pelecard.biz/PaymentGW?transactionId=5313aded-0b60-4bf3-9781-83d088b3c7c3","ConfirmationKey":"0c931d4cd8271f82f60a5c98be212f4a","Error":{"ErrCode":0}}'
Open

   * @return: {"URL":"https://gateway20.pelecard.biz/PaymentGW?transactionId=5313aded-0b60-4bf3-9781-83d088b3c7c3","ConfirmationKey":"0c931d4cd8271f82f60a5c98be212f4a","Error":{"ErrCode":0}}
Severity: Info
Found in src/Pelecard/PelecardPayment.php by phan

Returning type true but ValidatePayment() is declared to return string
Open

    return !empty(PelecardHttpRequest::pelecardPostRequest(self::PAYMENT_VALIDATE_URI, $this->PaymentResponse->getValidationRequestStruct())) ? TRUE : FALSE;
Severity: Minor
Found in src/Pelecard/PelecardPayment.php by phan

The parameter $PaymentResponse is not named in camelCase.
Open

  public function setPaymentResponse($PaymentResponse) {
    $this->PaymentResponse = $PaymentResponse;
  }
Severity: Minor
Found in src/Pelecard/PelecardPayment.php by phpmd

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 $PaymentRequest is not named in camelCase.
Open

  public function setPaymentRequest($PaymentRequest) {
    $this->PaymentRequest = $PaymentRequest;
  }
Severity: Minor
Found in src/Pelecard/PelecardPayment.php by phpmd

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

Method name "PelecardPayment::ValidatePayment" is not in camel caps format
Open

  public function ValidatePayment() {

TRUE, FALSE and NULL must be lowercase; expected "true" but found "TRUE"
Open

    return !empty(PelecardHttpRequest::pelecardPostRequest(self::PAYMENT_VALIDATE_URI, $this->PaymentResponse->getValidationRequestStruct())) ? TRUE : FALSE;

Opening brace of a class must be on the line after the definition
Open

class PelecardPayment {

Method name "PelecardPayment::SubmitPaymentRequest" is not in camel caps format
Open

  public function SubmitPaymentRequest() {

The closing brace for the class must go on the next line after the body
Open

}

TRUE, FALSE and NULL must be lowercase; expected "false" but found "FALSE"
Open

    return !empty(PelecardHttpRequest::pelecardPostRequest(self::PAYMENT_VALIDATE_URI, $this->PaymentResponse->getValidationRequestStruct())) ? TRUE : FALSE;

Line exceeds 120 characters; contains 157 characters
Open

    return !empty(PelecardHttpRequest::pelecardPostRequest(self::PAYMENT_VALIDATE_URI, $this->PaymentResponse->getValidationRequestStruct())) ? TRUE : FALSE;

Opening brace should be on a new line
Open

  public function ValidatePayment() {

Opening brace should be on a new line
Open

  public function SubmitPaymentRequest() {

Line indented incorrectly; expected at least 4 spaces, found 2
Open

  const PAYMENT_VALIDATE_URI = 'PaymentGW/ValidateByUniqueKey';

Line indented incorrectly; expected 4 spaces, found 2
Open

  public function setPaymentRequest($PaymentRequest) {

Opening brace should be on a new line
Open

  public function setPaymentRequest($PaymentRequest) {

Line indented incorrectly; expected 4 spaces, found 2
Open

  public function SubmitPaymentRequest() {

Line indented incorrectly; expected 4 spaces, found 2
Open

  }

Line indented incorrectly; expected at least 4 spaces, found 2
Open

  const PAYMENT_INIT_URI = 'PaymentGW/init';

Line indented incorrectly; expected at least 8 spaces, found 4
Open

    return PelecardHttpRequest::pelecardPostRequest(self::PAYMENT_INIT_URI, $this->PaymentRequest);

Line indented incorrectly; expected at least 8 spaces, found 4
Open

    $this->PaymentRequest = $PaymentRequest;

Line indented incorrectly; expected 4 spaces, found 2
Open

  }

Opening brace should be on a new line
Open

  public function setPaymentResponse($PaymentResponse) {

Line indented incorrectly; expected 4 spaces, found 2
Open

  public function setPaymentResponse($PaymentResponse) {

Line indented incorrectly; expected 4 spaces, found 2
Open

  private $PaymentRequest;

Line indented incorrectly; expected 4 spaces, found 2
Open

  private $PaymentResponse;

Line indented incorrectly; expected at least 8 spaces, found 4
Open

    $this->PaymentResponse = $PaymentResponse;

Line indented incorrectly; expected 4 spaces, found 2
Open

  public function ValidatePayment() {

Line indented incorrectly; expected 4 spaces, found 2
Open

  }

Line indented incorrectly; expected at least 8 spaces, found 4
Open

    return !empty(PelecardHttpRequest::pelecardPostRequest(self::PAYMENT_VALIDATE_URI, $this->PaymentResponse->getValidationRequestStruct())) ? TRUE : FALSE;

Line indented incorrectly; expected 4 spaces, found 2
Open

  }

The variable $PaymentResponse is not named in camelCase.
Open

  public function setPaymentResponse($PaymentResponse) {
    $this->PaymentResponse = $PaymentResponse;
  }
Severity: Minor
Found in src/Pelecard/PelecardPayment.php by phpmd

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 $PaymentRequest is not named in camelCase.
Open

  public function setPaymentRequest($PaymentRequest) {
    $this->PaymentRequest = $PaymentRequest;
  }
Severity: Minor
Found in src/Pelecard/PelecardPayment.php by phpmd

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 method SubmitPaymentRequest is not named in camelCase.
Open

  public function SubmitPaymentRequest() {
    return PelecardHttpRequest::pelecardPostRequest(self::PAYMENT_INIT_URI, $this->PaymentRequest);
  }
Severity: Minor
Found in src/Pelecard/PelecardPayment.php by phpmd

CamelCaseMethodName

Since: 0.2

It is considered best practice to use the camelCase notation to name methods.

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method ValidatePayment is not named in camelCase.
Open

  public function ValidatePayment() {
    return !empty(PelecardHttpRequest::pelecardPostRequest(self::PAYMENT_VALIDATE_URI, $this->PaymentResponse->getValidationRequestStruct())) ? TRUE : FALSE;
  }
Severity: Minor
Found in src/Pelecard/PelecardPayment.php by phpmd

CamelCaseMethodName

Since: 0.2

It is considered best practice to use the camelCase notation to name methods.

Example

class ClassName {
    public function get_name() {
    }
}

Source

There are no issues that match your filters.

Category
Status