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.

AddTestingSupportForInclude   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 2
dl 0
loc 42
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A call() 0 27 1
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
 * @author Maxime Beaudoin <[email protected]>
12
 */
13
trait AddTestingSupportForInclude
14
{
15
    /**
16
     * Call the given URI and return the Response.
17
     *
18
     * @param  string  $method
19
     * @param  string  $uri
20
     * @param  array   $parameters
21
     * @param  array   $cookies
22
     * @param  array   $files
23
     * @param  array   $server
24
     * @param  string  $content
25
     * @return \Illuminate\Http\Response
26
     */
27
    public function call($method, $uri, $parameters = [], $cookies = [], $files = [], $server = [], $content = null)
28
    {
29
        $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...
30
31
        $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...
32
33
        $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...
34
35
        $symfonyRequest = SymfonyRequest::create(
36
            $this->currentUri, $method, $parameters,
37
            $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...
38
        );
39
40
        $request = Request::createFromBase($symfonyRequest);
41
42
        $response = app(\EllipseSynergie\ApiResponse\Contracts\Response::class);
43
44
        $response
45
            ->getManager()
46
            ->parseIncludes(explode(',', $request->get('include')));
47
48
        $response = $kernel->handle($request);
49
50
        $kernel->terminate($request, $response);
51
52
        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...
53
    }
54
}
55