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

HeaderAuthenticationHandler::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 3
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