Credentials::getAll()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * Gateway Class
6
 * @category    Ticaje
7
 * @author      Max Demian <[email protected]>
8
 */
9
10
namespace Ticaje\AConnector\Gateway\Provider;
11
12
use Ticaje\Contract\Traits\Getter;
13
14
use Ticaje\AConnector\Interfaces\CredentialInterface;
15
16
/**
17
 * Class Credentials
18
 * @package Ticaje\AConnector\Gateway\Provider
19
 */
20
class Credentials implements CredentialInterface
21
{
22
    use Getter;
23
24
    private $username;
25
26
    private $password;
27
28
    private $host;
29
30
    private $port;
31
32
    /**
33
     * @inheritDoc
34
     */
35
    public function set(array $credentials): CredentialInterface
36
    {
37
        $attributes = array_keys(get_object_vars($this));
38
        foreach ($attributes as $attribute) {
39
            $this->$attribute = isset($credentials[$attribute]) ? $credentials[$attribute] : null;
40
        }
41
        return $this;
42
    }
43
44
    /**
45
     * @inheritDoc
46
     */
47
    public function getAll(): array
48
    {
49
        return get_object_vars($this);
50
    }
51
}
52