SergioMadness/payment-laravel

View on GitHub
src/Payment.php

Summary

Maintainability
C
1 day
Test Coverage

Payment has 43 functions (exceeds 20 allowed). Consider refactoring.
Open

class Payment implements PaymentFacade
{
    /**
     * Available drivers
     *
Severity: Minor
Found in src/Payment.php - About 5 hrs to fix

    Method getPaymentForm has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function getPaymentForm($orderId,
                                       $paymentId,
                                       float $amount,
                                       string $currency = self::CURRENCY_RUR,
                                       string $paymentType = self::PAYMENT_TYPE_CARD,
    Severity: Major
    Found in src/Payment.php - About 1 hr to fix

      Method getPaymentLink has 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function getPaymentLink($orderId,
                                         $paymentId,
                                         float $amount,
                                         string $currency = self::CURRENCY_RUR,
                                         string $paymentType = self::PAYMENT_TYPE_CARD,
      Severity: Major
      Found in src/Payment.php - About 1 hr to fix

        The method getPaymentLink has 10 parameters. Consider reducing the number of parameters to less than 10.
        Open

            public function getPaymentLink($orderId,
                                           $paymentId,
                                           float $amount,
                                           string $currency = self::CURRENCY_RUR,
                                           string $paymentType = self::PAYMENT_TYPE_CARD,
        Severity: Minor
        Found in src/Payment.php by phpmd

        The method getPaymentForm has 10 parameters. Consider reducing the number of parameters to less than 10.
        Open

            public function getPaymentForm($orderId,
                                           $paymentId,
                                           float $amount,
                                           string $currency = self::CURRENCY_RUR,
                                           string $paymentType = self::PAYMENT_TYPE_CARD,
        Severity: Minor
        Found in src/Payment.php by phpmd

        Avoid assigning values to variables in if clauses and the like (line '499', column '14').
        Open

            public function driverInstance(string $driver): ?PayService
            {
                if (($driverClass = $this->getDriver($driver)) !== null) {
                    return app($driverClass, [
                        'config' => config('payment.' . $driverClass),
        Severity: Minor
        Found in src/Payment.php by phpmd

        IfStatementAssignment

        Since: 2.7.0

        Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($foo = 'bar') { // possible typo
                    // ...
                }
                if ($baz = 0) { // always false
                    // ...
                }
            }
        }

        Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

        Avoid unused parameters such as '$protocol'.
        Open

            public function setTransport(PayProtocol $protocol): PayService
        Severity: Minor
        Found in src/Payment.php by phpmd

        UnusedFormalParameter

        Since: 0.2

        Avoid passing parameters to methods or constructors and then not using those parameters.

        Example

        class Foo
        {
            private function bar($howdy)
            {
                // $howdy is not used
            }
        }

        Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

        The closing parenthesis of a multi-line function declaration must be on a new line
        Open

                                           Receipt $receipt = null): Form
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        Multi-line function declaration not indented correctly; expected 8 spaces but found 35
        Open

                                           string $description = '',
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line
        Open

            {
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        Multi-line function declaration not indented correctly; expected 8 spaces but found 35
        Open

                                           string $successReturnUrl = '',
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        Multi-line function declaration not indented correctly; expected 8 spaces but found 35
        Open

                                           Receipt $receipt = null): Form
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        Multi-line function declaration not indented correctly; expected 8 spaces but found 35
        Open

                                           float $amount,
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        Multi-line function declaration not indented correctly; expected 8 spaces but found 35
        Open

                                           string $failReturnUrl = '',
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        The first parameter of a multi-line function declaration must be on the line after the opening bracket
        Open

            public function getPaymentForm($orderId,
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        Multi-line function declaration not indented correctly; expected 8 spaces but found 35
        Open

                                           string $successReturnUrl = '',
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        Multi-line function declaration not indented correctly; expected 8 spaces but found 35
        Open

                                           string $failReturnUrl = '',
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        Multi-line function declaration not indented correctly; expected 8 spaces but found 35
        Open

                                           float $amount,
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        Multi-line function declaration not indented correctly; expected 8 spaces but found 35
        Open

                                           string $description = '',
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        Multi-line function declaration not indented correctly; expected 8 spaces but found 35
        Open

                                           array $extraParams = [],
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        Multi-line function declaration not indented correctly; expected 8 spaces but found 35
        Open

                                           Receipt $receipt = null): string
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        Multi-line function declaration not indented correctly; expected 8 spaces but found 35
        Open

                                           string $paymentType = self::PAYMENT_TYPE_CARD,
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        The first parameter of a multi-line function declaration must be on the line after the opening bracket
        Open

            public function getPaymentLink($orderId,
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        Multi-line function declaration not indented correctly; expected 8 spaces but found 35
        Open

                                           $paymentId,
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        Multi-line function declaration not indented correctly; expected 8 spaces but found 35
        Open

                                           string $currency = self::CURRENCY_RUR,
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        Multi-line function declaration not indented correctly; expected 8 spaces but found 35
        Open

                                           string $currency = self::CURRENCY_RUR,
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        Multi-line function declaration not indented correctly; expected 8 spaces but found 35
        Open

                                           array $extraParams = [],
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        Multi-line function declaration not indented correctly; expected 8 spaces but found 35
        Open

                                           string $paymentType = self::PAYMENT_TYPE_CARD,
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        The closing parenthesis of a multi-line function declaration must be on a new line
        Open

                                           Receipt $receipt = null): string
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        Multi-line function declaration not indented correctly; expected 8 spaces but found 35
        Open

                                           $paymentId,
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line
        Open

            {
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        Multi-line function call not indented correctly; expected 8 spaces but found 12
        Open

                    $receipt);
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        Closing parenthesis of a multi-line function call must be on a line by itself
        Open

                    $receipt);
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        Multi-line function call not indented correctly; expected 8 spaces but found 12
        Open

                    $receipt);
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        Expected 1 newline at end of file; 0 found
        Open

        }
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        Closing parenthesis of a multi-line function call must be on a line by itself
        Open

                    $receipt);
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        Opening parenthesis of a multi-line function call must be the last content on the line
        Open

                return $this->getCurrentDriver()->getPaymentLink($orderId,
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        Opening parenthesis of a multi-line function call must be the last content on the line
        Open

                return $this->getCurrentDriver()->getPaymentForm($orderId,
        Severity: Minor
        Found in src/Payment.php by phpcodesniffer

        There are no issues that match your filters.

        Category
        Status