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.
Completed
Push — master ( fc84de...edddc7 )
by Maxime
02:55
created

AddTestingSupportForInclude::call()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 27
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 27
rs 8.8571
c 0
b 0
f 0
ccs 0
cts 18
cp 0
cc 1
eloc 15
nc 1
nop 7
crap 2
1
<?php
2
3
namespace EllipseSynergie\ApiResponse\Testing\Laravel;
4
5
use Illuminate\Http\Request;
6
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
7
8
/**
9
 * Class AddTestingSupportForInclude
10
 * @package EllipseSynergie\ApiResponse\Testing\Laravel
11
 */
12
trait AddTestingSupportForInclude
13
{
14
    /**
15
     * Call the given URI and return the Response.
16
     *
17
     * @param  string  $method
18
     * @param  string  $uri
19
     * @param  array   $parameters
20
     * @param  array   $cookies
21
     * @param  array   $files
22
     * @param  array   $server
23
     * @param  string  $content
24
     * @return \Illuminate\Http\Response
25
     */
26
    public function call($method, $uri, $parameters = [], $cookies = [], $files = [], $server = [], $content = null)
27
    {
28
        $kernel = $this->app->make('Illuminate\Contracts\Http\Kernel');
0 ignored issues
show
Bug introduced by
The property app does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
29
30
        $this->currentUri = $this->prepareUrlForRequest($uri);
0 ignored issues
show
Bug introduced by
The property currentUri does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
Bug introduced by
It seems like prepareUrlForRequest() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
31
32
        $this->resetPageContext();
0 ignored issues
show
Bug introduced by
It seems like resetPageContext() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
33
34
        $symfonyRequest = SymfonyRequest::create(
35
            $this->currentUri, $method, $parameters,
36
            $cookies, $this->filterFiles($files), array_replace($this->serverVariables, $server), $content
0 ignored issues
show
Bug introduced by
The property serverVariables does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
Bug introduced by
It seems like filterFiles() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
37
        );
38
39
        $request = Request::createFromBase($symfonyRequest);
40
41
        $response = app(\EllipseSynergie\ApiResponse\Contracts\Response::class);
42
43
        $response
44
            ->getManager()
45
            ->parseIncludes(explode(',', $request->get('include')));
46
47
        $response = $kernel->handle($request);
48
49
        $kernel->terminate($request, $response);
50
51
        return $this->response = $response;
0 ignored issues
show
Bug introduced by
The property response does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
52
    }
53
}
54