TokenAuthentication::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
4
namespace Dolibarr\Client\Security\Authentication;
5
6
use Webmozart\Assert\Assert;
7
8
/**
9
 * Token based authentication on the Dolibarr API.
10
 *
11
 * @author Laurent De Coninck <[email protected]>
12
 */
13
class TokenAuthentication extends AbstractAuthentication
14
{
15
16
    /**
17
     * @param string $token
18
     */
19
    public function __construct($token)
20
    {
21
        Assert::stringNotEmpty($token);
22
23
        parent::__construct();
24
        $this->addHeader('Dolapikey', $token);
25
    }
26
}
27