sant0ro/chocolatey

View on GitHub
app/Http/Controllers/ShopController.php

Summary

Maintainability
A
35 mins
Test Coverage

Method success has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function success(Request $request, string $paymentCategory, int $countryCode, int $shopItem, int $paymentMethod)
Severity: Minor
Found in app/Http/Controllers/ShopController.php - About 35 mins to fix

    Avoid unused parameters such as '$request'.
    Open

        public function success(Request $request, string $paymentCategory, int $countryCode, int $shopItem, int $paymentMethod)

    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

    Avoid unused parameters such as '$request'.
    Open

        public function getPurse(Request $request): JsonResponse

    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

    TODO found
    Open

         * @TODO: Need to Test if really works

    TODO found
    Open

         * @TODO: User Purchase History will be coded on the Future

    TODO found
    Open

         * @TODO: Code Business Logic

    TODO found
    Open

         * @TODO: All Purchases of the CMS are Manually, so will be difficult track.

    TODO found
    Open

         * @TODO: Probably Administrators will Manually Insert History Through HK

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

        public function redeem(Request $request): JsonResponse
        {
            if (($voucher = Voucher::where('code', $request->json()->get('voucherCode'))->first()) == null) {
                return response()->json(null, 404);
            }

    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

    There are no issues that match your filters.

    Category
    Status