AnonymousRequestMatcher   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 20
ccs 0
cts 16
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 17 2
1
<?php
2
3
/*
4
 * This file is part of the FOSHttpCacheBundle package.
5
 *
6
 * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace FOS\HttpCacheBundle\UserContext;
13
14
use FOS\HttpCache\UserContext\AnonymousRequestMatcher as BaseAnonymousRequestMatcher;
15
16
/**
17
 * Matches anonymous requests using a list of identification headers.
18
 *
19
 * @deprecated Use AnonymousRequestMatcher of HttpCache library
20
 */
21
class AnonymousRequestMatcher extends BaseAnonymousRequestMatcher
22
{
23
    public function __construct(array $options = [])
24
    {
25
        @trigger_error(
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
26
            'AnonymousRequestMatcher of HttpCacheBundle is deprecated. '.
27
            'Use AnonymousRequestMatcher of HttpCache library.',
28
            E_USER_DEPRECATED
29
        );
30
31
        if (isset($options['user_identifier_headers'], $options['session_name_prefix'])) {
32
            parent::__construct($options);
33
        } else {
34
            parent::__construct([
35
                'user_identifier_headers' => $options,
36
                'session_name_prefix' => 'PHPSESSID',
37
            ]);
38
        }
39
    }
40
}
41