BillPayment::toArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 5
Ratio 100 %

Importance

Changes 0
Metric Value
dl 5
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace WeDevBr\Bankly;
4
5
use Illuminate\Contracts\Support\Arrayable;
6
use WeDevBr\Bankly\Validators\BillPaymentValidator;
7
8
/**
9
 * BillPayment class
10
 *
11
 * PHP version 7.3|7.4|8.0
12
 *
13
 * @author    WeDev Brasil Team <[email protected]>
14
 * @author    Rafael Teixeira <[email protected]>
15
 * @copyright 2020 We Dev Tecnologia Ltda
16
 * @link      https://github.com/wedevBr/bankly-laravel/
17
 */
18 View Code Duplication
class BillPayment extends \stdClass implements Arrayable
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
19
{
20
    public $amount;
21
    public $bankBranch;
22
    public $bankAccount;
23
    public $description;
24
    public $id;
25
26
    /**
27
     * This validate and return an array
28
     * @return array
29
     */
30
    public function toArray(): array
31
    {
32
        $this->validate();
33
        return (array) $this;
34
    }
35
36
    /**
37
     * This function validate a bill payment
38
     */
39
    public function validate()
40
    {
41
        $validator = new BillPaymentValidator($this);
42
        $validator->validate();
43
    }
44
}
45