Status304::consolidate()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 18
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 18
ccs 0
cts 13
cp 0
rs 9.8666
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 6
1
<?php namespace Comodojo\Dispatcher\Response\Preprocessor;
2
3
use \Comodojo\Dispatcher\Response\Model as Response;
4
5
/**
6
 * Status: Not Modified
7
 *
8
 * @package     Comodojo Dispatcher
9
 * @author      Marco Giovinazzi <[email protected]>
10
 * @license     MIT
11
 *
12
 * LICENSE:
13
 *
14
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
 * THE SOFTWARE.
21
 */
22
23
class Status304 extends Status100 {
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function consolidate(Response $response) {
29
30
        $cleanup = [
31
            'Allow',
32
            'Content-Encoding',
33
            'Content-Language',
34
            'Content-Length',
35
            'Content-MD5',
36
            'Content-Type',
37
            'Last-Modified'
38
         ];
39
40
        foreach ($cleanup as $header) {
41
            $response->getHeaders()
42
                ->delete($header);
43
        }
44
45
        parent::consolidate();
0 ignored issues
show
Bug introduced by
The call to Comodojo\Dispatcher\Resp...tatus100::consolidate() has too few arguments starting with response. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

45
        parent::/** @scrutinizer ignore-call */ 
46
                consolidate();

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
46
47
    }
48
49
}
50