Passed
Push — master ( 36b0e9...650f65 )
by Ludwig
02:12
created

SymfonyClient   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 27
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
    private $hostname;
26
27
    public function __construct($clientId, $clientSecret, $username, $password, $hostname)
28
    {
29
        $this->clientId = $clientId;
30
        $this->clientSecret = $clientSecret;
31
        $this->username = $username;
32
        $this->password = $password;
33
        $this->hostname = $hostname;
34
35
        parent::__construct();
36
    }
37
38
    public function authenticate(): Token
39
    {
40
        return parent::authenticatePassword($this->clientId, $this->clientSecret, $this->username, $this->password);
41
    }
42
43
    public function refresh($refreshToken): Token
44
    {
45
        return parent::refreshToken($this->clientId, $this->clientSecret, $refreshToken);
46
    }
47
}
48