1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace SmartCNAB\Services\Remittances\Banks\SICOOB; |
4
|
|
|
|
5
|
|
|
use SmartCNAB\Support\File\Remittance; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class for SICOOB 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 an account on detail. |
21
|
|
|
* |
22
|
|
|
* @param mixed $value |
23
|
|
|
* @return mixed |
24
|
|
|
*/ |
25
|
|
|
protected function mutateDetailAccount($value) |
26
|
|
|
{ |
27
|
|
|
return $value; |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Mutates an account DV on detail. |
32
|
|
|
* |
33
|
|
|
* @param mixed $value |
34
|
|
|
* @param array $data |
35
|
|
|
* @return mixed |
36
|
|
|
*/ |
37
|
|
|
protected function mutateDetailAccountDv( |
38
|
|
|
$value, |
39
|
|
|
array $data = [] |
40
|
|
|
) { |
41
|
|
|
if (empty($data['accountDv'])) return $value; |
42
|
|
|
|
43
|
|
|
return $value ?: $data['accountDv']; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Mutates a branch on detail. |
48
|
|
|
* |
49
|
|
|
* @param mixed $value |
50
|
|
|
* @param array $data |
51
|
|
|
* @param array $meta |
52
|
|
|
* @return mixed |
53
|
|
|
*/ |
54
|
|
|
protected function mutateDetailBranch( |
55
|
|
|
$value, |
56
|
|
|
array $data = [], |
57
|
|
|
array $meta = [] |
58
|
|
|
) { |
59
|
|
|
return $this->mutateHeaderBranch($value, $data, $meta); |
|
|
|
|
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Mutates a branch DV on detail. |
64
|
|
|
* |
65
|
|
|
* @param mixed $value |
66
|
|
|
* @param array $data |
67
|
|
|
* @param array $meta |
68
|
|
|
* @return mixed |
69
|
|
|
*/ |
70
|
|
|
protected function mutateDetailBranchDv( |
71
|
|
|
$value, |
72
|
|
|
array $data = [], |
73
|
|
|
array $meta = [] |
74
|
|
|
) { |
75
|
|
|
return $this->mutateHeaderBranchDv($value, $data, $meta); |
|
|
|
|
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* Mutates a company document type. |
80
|
|
|
* |
81
|
|
|
* @param mixed $value |
82
|
|
|
* @param array $data |
83
|
|
|
* @return mixed |
84
|
|
|
*/ |
85
|
|
|
protected function mutateDetailCompanyDocumentType( |
86
|
|
|
$value, |
|
|
|
|
87
|
|
|
array $data = [] |
88
|
|
|
) { |
89
|
|
|
return strlen($data['companyDocument']) === 14 ? 2 : 1; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* Mutates a discount to date. |
94
|
|
|
* |
95
|
|
|
* @param mixed $value |
96
|
|
|
* @param array $data |
97
|
|
|
* @return mixed |
98
|
|
|
*/ |
99
|
|
|
protected function mutateDetailDiscountTo( |
100
|
|
|
$value, |
101
|
|
|
array $data = [] |
102
|
|
|
) { |
103
|
|
|
if($data['discount'] == '0') return ''; |
104
|
|
|
|
105
|
|
|
return $value ?: $data['expiration']; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Mutates a document type. |
110
|
|
|
* |
111
|
|
|
* @param mixed $value |
112
|
|
|
* @param array $data |
113
|
|
|
* @return mixed |
114
|
|
|
*/ |
115
|
|
|
protected function mutateDetailDocumentType( |
116
|
|
|
$value, |
|
|
|
|
117
|
|
|
array $data = [] |
118
|
|
|
) { |
119
|
|
|
return strlen($data['document']) === 14 ? 2 : 1; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* Mutates a guarantee contract on detail. |
124
|
|
|
* |
125
|
|
|
* @param mixed $value |
126
|
|
|
* @return mixed |
127
|
|
|
*/ |
128
|
|
|
protected function mutateDetailGuaranteeContract($value) |
129
|
|
|
{ |
130
|
|
|
return substr($value, 0, -1); |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* Mutates a guarantee contract DV on detail. |
135
|
|
|
* |
136
|
|
|
* @param mixed $value |
137
|
|
|
* @param array $data |
138
|
|
|
* @return mixed |
139
|
|
|
*/ |
140
|
|
|
protected function mutateDetailGuaranteeContractDv( |
141
|
|
|
$value, |
142
|
|
|
array $data = [] |
143
|
|
|
) { |
144
|
|
|
if (empty($data['guaranteeContract'])) return $value; |
145
|
|
|
|
146
|
|
|
return $value ?: substr($data['guaranteeContract'], -1); |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* Mutates a receive branch on detail. |
151
|
|
|
* |
152
|
|
|
* @param mixed $value |
153
|
|
|
* @param array $data |
154
|
|
|
* @param array $meta |
155
|
|
|
* @return mixed |
156
|
|
|
*/ |
157
|
|
View Code Duplication |
protected function mutateDetailReceiveBranch( |
|
|
|
|
158
|
|
|
$value, |
159
|
|
|
array $data = [], |
160
|
|
|
array $meta = [] |
|
|
|
|
161
|
|
|
) { |
162
|
|
|
if (empty($data['branch'])) return $value; |
163
|
|
|
|
164
|
|
|
return empty($data['branch']) ? $value : $data['branch']; |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* Mutates a receive branch DV on detail. |
169
|
|
|
* |
170
|
|
|
* @param mixed $value |
171
|
|
|
* @param array $data |
172
|
|
|
* @param array $meta |
173
|
|
|
* @return mixed |
174
|
|
|
*/ |
175
|
|
View Code Duplication |
protected function mutateDetailReceiveBranchDv( |
|
|
|
|
176
|
|
|
$value, |
177
|
|
|
array $data = [], |
178
|
|
|
array $meta = [] |
|
|
|
|
179
|
|
|
) { |
180
|
|
|
if (empty($data['branch'])) return $value; |
181
|
|
|
|
182
|
|
|
return empty($data['branchDv']) ? $value : $data['branchDv']; |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
/** |
186
|
|
|
* Mutates a branch on header. |
187
|
|
|
* |
188
|
|
|
* @param mixed $value |
189
|
|
|
* @return mixed |
190
|
|
|
*/ |
191
|
|
|
protected function mutateHeaderBranch($value) |
192
|
|
|
{ |
193
|
|
|
return $value; |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
/** |
197
|
|
|
* Mutates a branch DV on header. |
198
|
|
|
* |
199
|
|
|
* @param mixed $value |
200
|
|
|
* @param array $data |
201
|
|
|
* @return mixed |
202
|
|
|
*/ |
203
|
|
View Code Duplication |
protected function mutateHeaderBranchDv( |
|
|
|
|
204
|
|
|
$value, |
205
|
|
|
array $data = [] |
206
|
|
|
) { |
207
|
|
|
if (empty($data['branch'])) return $value; |
208
|
|
|
|
209
|
|
|
return empty($data['branchDv']) ? $value : $data['branchDv']; |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* Mutates a company code on header. |
214
|
|
|
* |
215
|
|
|
* @param mixed $value |
216
|
|
|
* @param array $data |
217
|
|
|
* @return mixed |
218
|
|
|
*/ |
219
|
|
View Code Duplication |
protected function mutateHeaderCompanyCode( |
|
|
|
|
220
|
|
|
$value, |
221
|
|
|
array $data = [] |
222
|
|
|
) { |
223
|
|
|
if (empty($data['companyCode'])) return $value; |
224
|
|
|
|
225
|
|
|
return $value ? substr($value, 0, -1) : substr($data['companyCode'], 0, -1); |
226
|
|
|
} |
227
|
|
|
|
228
|
|
|
/** |
229
|
|
|
* Mutates a company code DV on header. |
230
|
|
|
* |
231
|
|
|
* @param mixed $value |
232
|
|
|
* @param array $data |
233
|
|
|
* @return mixed |
234
|
|
|
*/ |
235
|
|
View Code Duplication |
protected function mutateHeaderCompanyCodeDv( |
|
|
|
|
236
|
|
|
$value, |
237
|
|
|
array $data = [] |
238
|
|
|
) { |
239
|
|
|
if (empty($data['companyCode'])) return $value; |
240
|
|
|
|
241
|
|
|
return $value ? substr($data['value'], -1) : substr($data['companyCode'], -1); |
242
|
|
|
} |
243
|
|
|
} |
244
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.