Passed
Push — develop ( 2b301a...ddf000 )
by Kevin
10:40 queued 01:33
created

ViewConfiguration::setJqueryUrl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 0
cts 3
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Magium\Configuration\View;
4
5
use Psr\Http\Message\MessageInterface;
6
use Psr\Http\Message\ResponseInterface;
7
use Psr\Http\Message\ServerRequestInterface;
8
9
class ViewConfiguration
10
{
11
12
    protected $request;
13
    protected $response;
14
    protected $layoutFile;
15
    protected $viewDirectory;
16
    protected $viewFile;
17
    protected $jqueryUrl;
18
    protected $provideWrapperHtml;
19
20
    /**
21
     * ViewConfiguration constructor.
22
     * @param ServerRequestInterface $request
23
     * @param MessageInterface $response
24
     * @param string $viewDirectory
25
     * @param string $layoutFile
26
     * @param string $viewFile
27
     * @param boolean $provideWrapperHtml
28
     * @param boolean $provideJqueryUrl
0 ignored issues
show
Documentation introduced by
There is no parameter named $provideJqueryUrl. Did you maybe mean $jqueryUrl?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
29
     * @throws InvalidViewConfigurationException
30
     */
31
    public function __construct(
32
        ServerRequestInterface $request,
33
        MessageInterface $response,
34
        $viewDirectory = __DIR__ . '/views' ,
35
        $layoutFile = 'layout.phtml',
36
        $viewFile = 'view.phtml',
37
        $provideWrapperHtml = true,
38
        $jqueryUrl = true
39
    )
40
    {
41
        $this->setRequest($request);
42
        $this->setResponse($response);
43
        $this->setViewDirectory($viewDirectory);
44
        $this->setLayoutFile($layoutFile);
45
        $this->setViewFile($viewFile);
46
        $this->setProvideWrapperHtml($provideWrapperHtml);
47
        $this->setJqueryUrl($jqueryUrl);
48
    }
49
50
    /**
51
     * @return mixed
52
     */
53
    public function getProvideWrapperHtml()
54
    {
55
        return $this->provideWrapperHtml;
56
    }
57
58
    /**
59
     * @param mixed $provideWrapperHtml
60
     */
61
    public function setProvideWrapperHtml($provideWrapperHtml)
62
    {
63
        $this->provideWrapperHtml = $provideWrapperHtml;
64
    }
65
66
    /**
67
     * @return ServerRequestInterface
68
     */
69
    public function getRequest()
70
    {
71
        return $this->request;
72
    }
73
74
    /**
75
     * @param ServerRequestInterface $request
76
     */
77
    public function setRequest(ServerRequestInterface $request)
78
    {
79
        $this->request = $request;
80
    }
81
82
    /**
83
     * @return ResponseInterface
84
     */
85
    public function getResponse()
86
    {
87
        return $this->response;
88
    }
89
90
    /**
91
     * @param MessageInterface $response
92
     */
93
    public function setResponse(MessageInterface $response)
94
    {
95
        $this->response = $response;
96
    }
97
98
    /**
99
     * @return string
100
     */
101
    public function getLayoutFile()
102
    {
103
        return $this->layoutFile;
104
    }
105
106
    /**
107
     * @param string $layoutFile
108
     * @throws InvalidViewConfigurationException
109
     */
110 View Code Duplication
    public function setLayoutFile($layoutFile)
111
    {
112
        $this->layoutFile = realpath($this->getViewDirectory() . DIRECTORY_SEPARATOR . $layoutFile);
113
        if (!is_file($this->layoutFile)) {
114
            throw new InvalidViewConfigurationException('Could not resolve base layout file: ' . $layoutFile);
115
        }
116
        $this->layoutFile = basename($this->layoutFile);
117
    }
118
119
    /**
120
     * @return string
121
     */
122
    public function getViewDirectory()
123
    {
124
        return $this->viewDirectory;
125
    }
126
127
    /**
128
     * @param string $viewDirectory
129
     * @throws InvalidViewConfigurationException
130
     */
131
    public function setViewDirectory($viewDirectory)
132
    {
133
        $this->viewDirectory = realpath($viewDirectory);
134
        if (!is_dir($this->viewDirectory)) {
135
            throw new InvalidViewConfigurationException('Could not resolve base view directory: ' . $viewDirectory);
136
        }
137
    }
138
139
    /**
140
     * @return string
141
     */
142
    public function getViewFile()
143
    {
144
        return $this->viewFile;
145
    }
146
147
    /**
148
     * @param string $viewFile
149
     * @throws InvalidViewConfigurationException
150
     */
151 View Code Duplication
    public function setViewFile($viewFile)
152
    {
153
        $this->viewFile = realpath($this->getViewDirectory() . DIRECTORY_SEPARATOR . $viewFile);
154
        if (!is_file($this->viewFile)) {
155
            throw new InvalidViewConfigurationException('Could not resolve base file file: ' . $viewFile);
156
        }
157
        $this->viewFile = basename($this->viewFile);
158
    }
159
160
    /**
161
     * @return bool
162
     */
163
    public function getJqueryUrl()
164
    {
165
        return $this->jqueryUrl;
166
    }
167
168
    /**
169
     * @param bool $jqueryUrl
170
     */
171
    public function setJqueryUrl($jqueryUrl)
172
    {
173
        $this->jqueryUrl = $jqueryUrl;
174
    }
175
176
177
178
179
}
180