Completed
Push — master ( dcc755...77cb3d )
by
unknown
14s queued 12s
created

Card::validate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace WeDevBr\Bankly\Types\Card;
4
5
use Illuminate\Contracts\Support\Arrayable;
6
use WeDevBr\Bankly\Validators\Card\CardValidator;
7
8
class Card 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\Card\Address */
32
    public $address;
33
34
    /** @var string */
35
    public $type;
36
37
    /**
38
     * This validate and return an array
39
     * @return array
40
     */
41
    public function toArray(): array
42
    {
43
        $this->validate();
44
        $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\Card\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...
45
46
        return (array) $this;
47
    }
48
49
    /**
50
     * This function validate a card address
51
     */
52
    public function validate()
53
    {
54
        $validator = new CardValidator($this);
55
        $validator->validate();
56
57
        return $this;
58
    }
59
}
60