Completed
Push — master ( 2a953d...5971d3 )
by
unknown
27s queued 10s
created

VirtualCard   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 49
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 7 1
A validate() 0 7 1
1
<?php
2
3
namespace WeDevBr\Bankly\Types\VirtualCard;
4
5
use Illuminate\Contracts\Support\Arrayable;
6
use WeDevBr\Bankly\Validators\VirtualCard\VirtualCardValidator;
7
8
class VirtualCard extends \stdClass implements Arrayable
9
{
10
    /** @var string */
11
    public $documentNumber;
12
13
    /** @var string */
14
    public $cardName;
15
16
    /** @var string */
17
    public $alias;
18
19
    /** @var string */
20
    public $bankAgency;
21
22
    /** @var string */
23
    public $bankAccount;
24
25
    /** @var string */
26
    public $programId;
27
28
    /** @var string */
29
    public $password;
30
31
    /** @var \WeDevBr\Bankly\Types\VirtualCard\Address */
32
    public $address;
33
34
    /**
35
     * This validate and return an array
36
     * @return array
37
     */
38
    public function toArray(): array
39
    {
40
        $this->validate();
41
        $this->address = $this->address->toArray();
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->address->toArray() of type array is incompatible with the declared type object<WeDevBr\Bankly\Types\VirtualCard\Address> of property $address.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
42
43
        return (array) $this;
44
    }
45
46
    /**
47
     * This function validate a virtual card address
48
     */
49
    public function validate()
50
    {
51
        $validator = new VirtualCardValidator($this);
52
        $validator->validate();
53
54
        return $this;
55
    }
56
}
57