Completed
Pull Request — master (#58)
by John
02:54
created

ApiTestClient::getKernel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 24 and the first side effect is on line 2.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
declare(strict_types = 1);
3
/*
4
 * This file is part of the KleijnWeb\SwaggerBundle package.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace KleijnWeb\SwaggerBundle\Test;
11
12
use Symfony\Bundle\FrameworkBundle\Client;
13
use Symfony\Component\HttpFoundation\Request;
14
use Symfony\Component\HttpFoundation\Response;
15
use Symfony\Component\DependencyInjection\ContainerInterface;
16
use Symfony\Component\DomCrawler\Crawler;
17
use Symfony\Component\BrowserKit\Request as BrowserRequest;
18
use Symfony\Component\HttpKernel\KernelInterface;
19
use Symfony\Component\HttpKernel\Profiler\Profile;
20
21
/**
22
 * @author John Kleijn <[email protected]>
23
 */
24
class ApiTestClient extends Client
25
{
26
    /**
27
     * @var Client
28
     */
29
    private $target;
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function __construct(Client $client)
35
    {
36
        $this->target = $client;
37
    }
38
39
    /**
40
     * Makes a request from a Request object directly.
41
     *
42
     * @param BrowserRequest $request       A Request instance
43
     * @param bool           $changeHistory Whether to update the history or not (only used internally for back(),
44
     *                                      forward(), and reload())
45
     *
46
     * @return Crawler
47
     */
48
    public function requestFromRequest(BrowserRequest $request, $changeHistory = true)
49
    {
50
        return $this->target->requestFromRequest($request, $changeHistory);
51
    }
52
53
    /**
54
     * @return Request
55
     */
56
    public function getRequest(): Request
57
    {
58
        return $this->target->getRequest();
59
    }
60
61
    /**
62
     * @return Response
63
     */
64
    public function getResponse(): Response
65
    {
66
        return $this->target->getResponse();
67
    }
68
69
    /**
70
     * @return ContainerInterface
71
     */
72
    public function getContainer(): ContainerInterface
73
    {
74
        return $this->target->getContainer();
75
    }
76
77
    /**
78
     * @return KernelInterface
79
     */
80
    public function getKernel(): KernelInterface
81
    {
82
        return $this->target->getKernel();
83
    }
84
85
    /**
86
     * @return Profile
87
     */
88
    public function getProfile(): Profile
89
    {
90
        return $this->target->getProfile();
91
    }
92
93
    /**
94
     * @return Profile
95
     */
96
    public function enableProfiler(): Profile
97
    {
98
        return $this->target->getProfile();
99
    }
100
101
    /**
102
     * @return void
103
     */
104
    public function disableReboot()
105
    {
106
        $this->target->disableReboot();
107
    }
108
109
    /**
110
     * @return void
111
     */
112
    public function enableReboot()
113
    {
114
        $this->target->enableReboot();
115
    }
116
}
117