Completed
Push — develop ( e149d8...a7cea2 )
by Lucas
08:25
created

HeaderFieldStrategy   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 21
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A apply() 0 4 1
1
<?php
2
/**
3
 * strategy for validating auth through the x-idp-username header
4
 */
5
6
namespace Graviton\SecurityBundle\Authentication\Strategies;
7
8
use Symfony\Component\HttpFoundation\Request;
9
10
/**
11
 * Class HeaderFieldStrategy
12
 *
13
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
14
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
15
 * @link     http://swisscom.ch
16
 */
17
class HeaderFieldStrategy extends AbstractHttpStrategy
18
{
19
    protected $field;
20
21
    /**
22
     * @param String $field field
23
     */
24 6
    public function __construct($field)
25
    {
26 6
        $this->field = $field;
27 6
    }
28
    /**
29
     * @param Request $request request to handle
30
     *
31
     * @return string
32
     */
33 6
    public function apply(Request $request)
34
    {
35 6
        return $this->extractFieldInfo($request->headers, $this->field);
36
    }
37
}
38