File400   A
last analyzed

Complexity

Total Complexity 13

Size/Duplication

Total Lines 84
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 13
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 84
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A mutateDetailCompanyDocumentType() 0 6 2
A mutateDetailLateInterestDate() 0 6 2
A mutateDetailLateInterestFlag() 0 6 2
A mutateDetailDocumentType() 0 6 2
B mutateDetailDeadline() 0 11 5
1
<?php
2
3
namespace SmartCNAB\Services\Remittances\Banks\Santander;
4
5
use SmartCNAB\Support\File\Remittance;
6
7
/**
8
 * Class for Santander remittance CNAB 400 layout.
9
 */
10
class File400 extends Remittance
11
{
12
    /**
13
     * File schema file.
14
     *
15
     * @var string
16
     */
17
    protected $schemaFile = '/schemas/400.json';
18
19
    /**
20
     * Mutates a company document type.
21
     *
22
     * @param  mixed  $value
23
     * @param  array  $data
24
     * @return mixed
25
     */
26
    protected function mutateDetailCompanyDocumentType(
27
        $value,
0 ignored issues
show
Unused Code introduced by
The parameter $value is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
28
        array $data = []
29
    ) {
30
        return strlen($data['companyDocument']) === 14 ? 2 : 1;
31
    }
32
33
    /**
34
     * Mutates a late interest date.
35
     *
36
     * @param  mixed  $value
37
     * @param  array  $data
38
     * @return mixed
39
     */
40
    protected function mutateDetailLateInterestDate(
41
        $value,
42
        array $data = []
43
    ) {
44
        return $value ?: $data['expiration']->add(new \DateInterval('P1D'));
45
    }
46
47
    /**
48
     * Mutates the late interest flag based on late interest percentage.
49
     *
50
     * @param  mixed  $value
51
     * @param  array  $data
52
     * @return mixed
53
     */
54
    protected function mutateDetailLateInterestFlag(
55
        $value,
0 ignored issues
show
Unused Code introduced by
The parameter $value is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
56
        array $data = []
57
    ) {
58
        return ( ! empty($data['lateInterestPercentage'])) ? 4 : 0;
59
    }
60
61
    /**
62
     * Mutates a document type.
63
     *
64
     * @param  mixed  $value
65
     * @param  array  $data
66
     * @return mixed
67
     */
68
    protected function mutateDetailDocumentType(
69
        $value,
0 ignored issues
show
Unused Code introduced by
The parameter $value is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
70
        array $data = []
71
    ) {
72
        return strlen($data['document']) === 14 ? 2 : 1;
73
    }
74
75
    /**
76
     * Mutates a deadline.
77
     *
78
     * @param  mixed  $value
79
     * @param  array  $data
80
     * @return mixed
81
     */
82
    protected function mutateDetailDeadline(
83
        $value,
84
        array $data = []
85
    ) {
86
        if ($data['instruction1'] == 6 || $data['instruction2'] == 6)
87
        {
88
            return $value ?: 0;
89
        }
90
91
        return !empty($data['deadline'])? $data['deadline'] : $value;
92
    }
93
}
94