Credentials::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 9.4286
cc 1
eloc 4
nc 1
nop 3
crap 1
1
<?php
2
3
/**
4
 * xOrder Client Credentials.
5
 *
6
 * @package     craftt/xorder-sdk
7
 * @author      Ryan Stratton <[email protected]>
8
 * @copyright   Copyright (c) Ryan Stratton
9
 * @license     https://github.com/craftt/xorder-php-sdk/blob/master/LICENSE.md Apache 2.0
10
 * @link        https://github.com/craftt/xorder-php-sdk
11
 */
12
13
namespace XOrder;
14
15
/**
16
 * Credentials
17
 */
18
class Credentials
19
{
20
21
    /**
22
     * @var string
23
     */
24
    protected $username;
25
26
    /**
27
     * @var string
28
     */
29
    protected $password;
30
31
    /**
32
     * @var string
33
     */
34
    protected $account;
35
36
    /**
37
     * Constructor
38
     *
39
     * @param string $username
40
     * @param string $password
41
     * @param string $account
42
     */
43 14
    public function __construct($username, $password, $account)
44
    {
45 14
        $this->username = $username;
46 14
        $this->password = $password;
47 14
        $this->account = $account;
48 14
    }
49
50
    /**
51
     * Returns a comma seperated string of the credentials
52
     * properties without the password.
53
     *
54
     * @return string
55
     */
56 2
    public function __toString()
57
    {
58 2
        return implode(',', $this->toArray());
59
    }
60
61
    /**
62
     * Get the BCLDB account id.
63
     *
64
     * @return string
65
     */
66 4
    public function getAccount()
67
    {
68 4
        return $this->account;
69
    }
70
71
    /**
72
     * Get the BCLDB account id.
73
     *
74
     * @return string
75
     */
76 2
    public function getBcldbId()
77
    {
78 2
        return $this->getAccount();
79
    }
80
81
    /**
82
     * Get the password.
83
     *
84
     * @return string
85
     */
86 2
    public function getPassword()
87
    {
88 2
        return $this->password;
89
    }
90
91
    /**
92
     * Get the username.
93
     *
94
     * @return string
95
     */
96 2
    public function getUsername()
97
    {
98 2
        return $this->username;
99
    }
100
101
    /**
102
     * Get the user's credentials as an array.
103
     *
104
     * @return array
105
     */
106 4
    public function toArray()
107
    {
108 4
        return [$this->username, $this->password, $this->account];
109
    }
110
}
111