Completed
Push — master ( 0eab77...b2f729 )
by Paul
05:35
created

HeaderAuthenticationHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 20
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 4 1
A getType() 0 4 1
1
<?php
2
3
namespace Victoire\Bundle\APIBusinessEntityBundle\Authentication;
4
5
use Victoire\Bundle\APIBusinessEntityBundle\Authentication\Interfaces\APIAuthenticationMethodInterface;
6
7
class HeaderAuthenticationHandler implements APIAuthenticationMethodInterface
8
{
9
    const TYPE = 'header';
10
11
    /**
12
     * Adds a http header to the curl request with the token.
13
     */
14
    public function handle($curl, &$getMethod, &$token)
15
    {
16
        curl_setopt($curl, CURLOPT_HTTPHEADER, sprintf('Authorization: %s', $token));
17
    }
18
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public static function getType()
23
    {
24
        return self::TYPE;
25
    }
26
}
27