5
5
use Boleto \Caixa \Interfaces \BoletoInterface ;
6
6
use Carbon \Carbon ;
7
7
use Boleto \Caixa \Interfaces \AgenteInterface as Agente ;
8
+ use Exception ;
8
9
use InvalidArgumentException ;
9
10
use JansenFelipe \Utils \Utils ;
10
11
11
12
/**
12
13
* Boleto
13
14
*
14
15
* @author Matheus Lopes Santos <fale_com_lopez@hotmail.com>
15
- * @version 1.0.0
16
- * @since 17 /09/2018
16
+ * @version 1.0.1
17
+ * @since 19 /09/2018
17
18
* @package Boleto\Caixa
18
19
*/
19
20
class Boleto implements BoletoInterface
@@ -370,6 +371,7 @@ public function getFichaCompensacao()
370
371
371
372
/**
372
373
* @param string $mensagem
374
+ * @throws InvalidArgumentException|Exception
373
375
*/
374
376
public function setFichaCompensacao ($ mensagem )
375
377
{
@@ -382,6 +384,10 @@ public function setFichaCompensacao($mensagem)
382
384
throw new InvalidArgumentException ('A mensagem deve ter no máximo 40 caracteres ' );
383
385
}
384
386
387
+ if ( count ($ this ->fichaCompensacao ) > 2 ) {
388
+ throw new Exception ('São permitidas apenas 2 mensagens para este campo ' );
389
+ }
390
+
385
391
array_push ($ this ->fichaCompensacao , $ mensagem );
386
392
}
387
393
}
@@ -396,6 +402,7 @@ public function getReciboPagador()
396
402
397
403
/**
398
404
* @param string $mensagem
405
+ * @throws InvalidArgumentException|Exception
399
406
*/
400
407
public function setReciboPagador ($ mensagem )
401
408
{
@@ -408,6 +415,10 @@ public function setReciboPagador($mensagem)
408
415
throw new InvalidArgumentException ('A mensagem deve ter no máximo 40 caracteres ' );
409
416
}
410
417
418
+ if ( count ($ this ->reciboPagador ) > 4 ) {
419
+ throw new Exception ('São permitidas apenas 4 mensagens para este campo ' );
420
+ }
421
+
411
422
array_push ($ this ->reciboPagador , $ mensagem );
412
423
}
413
424
}
0 commit comments