Password::toArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
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\PasswordValidator;
7
8
class Password extends \stdClass implements Arrayable
9
{
10
    /** @var string */
11
    public $password;
12
13
    /**
14
     * This validate and return an array
15
     * @return array
16
     */
17
    public function toArray(): array
18
    {
19
        $this->validate();
20
21
        return (array) $this;
22
    }
23
24
    /**
25
     * This function validate a card password
26
     */
27
    public function validate()
28
    {
29
        $validator = new PasswordValidator($this);
30
        $validator->validate();
31
32
        return $this;
33
    }
34
}
35