VerifyWebhookSignature::handle()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 4
c 1
b 0
f 1
dl 0
loc 9
rs 10
cc 2
nc 1
nop 2
1
<?php
2
3
namespace Vrajroham\LaravelBitpay\Http\Middlewares;
4
5
use Closure;
6
use Exception;
7
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\HttpKe...cessDeniedHttpException was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
9
class VerifyWebhookSignature
10
{
11
    /**
12
     * Handle the incoming request.
13
     *
14
     * @param \Illuminate\Http\Request $request
0 ignored issues
show
Bug introduced by
The type Illuminate\Http\Request was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
     * @param \Closure                 $next
16
     *
17
     * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
18
     *
19
     * @return \Illuminate\Http\Response
0 ignored issues
show
Bug introduced by
The type Illuminate\Http\Response was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
20
     */
21
    public function handle($request, Closure $next)
22
    {
23
        try {
24
            // Verify signature
25
        } catch (Exception $exception) {
0 ignored issues
show
Unused Code introduced by
catch (\Exception $exception) is not reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
26
            throw new AccessDeniedHttpException($exception->getMessage(), $exception);
27
        }
28
29
        return $next($request);
30
    }
31
}
32