SymfonyClient   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 26
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A authenticate() 0 3 1
A __construct() 0 9 1
A refresh() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of datamolino client.
5
 *
6
 * (c) 2018 cwd.at GmbH <[email protected]>
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
declare(strict_types=1);
13
14
namespace Cwd\Datamolino;
15
16
use Cwd\Datamolino\Client as CwdClient;
17
use Cwd\Datamolino\Model\Token;
18
19
class SymfonyClient extends CwdClient
20
{
21
    private $clientId;
22
    private $clientSecret;
23
    private $username;
24
    private $password;
25
26
    public function __construct($clientId, $clientSecret, $username, $password, $hostname)
27
    {
28
        $this->clientId = $clientId;
29
        $this->clientSecret = $clientSecret;
30
        $this->username = $username;
31
        $this->password = $password;
32
        $this->setApiUrl('https://'.$hostname);
33
34
        parent::__construct();
35
    }
36
37
    public function authenticate(): Token
38
    {
39
        return parent::authenticatePassword($this->clientId, $this->clientSecret, $this->username, $this->password);
40
    }
41
42
    public function refresh($refreshToken): Token
43
    {
44
        return parent::refreshToken($this->clientId, $this->clientSecret, $refreshToken);
45
    }
46
}
47