GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

OrAbort::__call()   A
last analyzed

Complexity

Conditions 5
Paths 5

Size

Total Lines 25

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 25
rs 9.2088
c 0
b 0
f 0
cc 5
nc 5
nop 2
1
<?php
2
3
namespace Spatie\OrAbort;
4
5
use ReflectionMethod;
6
7
trait OrAbort
8
{
9
    public function __call($methodName, array $args)
10
    {
11
        if (ends_with($methodName, 'OrAbort')) {
0 ignored issues
show
Deprecated Code introduced by
The function ends_with() has been deprecated with message: Str::endsWith() should be used directly instead. Will be removed in Laravel 6.0.

This function has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.

Loading history...
12
            $realMethodName = substr($methodName, 0, -7);
13
14
            $abortCode = null;
15
16
            $originalMethodParameterCount = (new ReflectionMethod($this, $realMethodName))->getNumberOfParameters();
17
18
            if (($originalMethodParameterCount + 1) == count($args)) {
19
                $abortCode = array_pop($args);
20
            }
21
22
            $originalMethodResult = call_user_func_array([$this, $realMethodName], $args);
23
24
            if ($originalMethodResult == false) {
25
                return abort($abortCode ?: 404);
26
            }
27
28
            return $originalMethodResult;
29
        }
30
31
32
        trigger_error('Call to undefined method '.__CLASS__.'::'.$methodName.'()', E_USER_ERROR);
33
    }
34
}
35