amountIsWithdrawWithoutNotebook()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace MidasSoft\DominicanBankParser\Validators;
4
5
use MidasSoft\DominicanBankParser\Interfaces\ValidatorInterface;
6
7
class ReservasValidator implements ValidatorInterface
8
{
9
    /**
10
     * {@inheritdoc}
11
     */
12 2
    public static function validate(array $deposit)
13
    {
14 2
        if (self::amountIsZero(trim($deposit[5]))) {
15
            return false;
16
        }
17
18 2
        if (self::amountIsWithdrawWithoutNotebook($deposit[2])) {
19
            return false;
20
        }
21
22 2
        return true;
23
    }
24
25
    /**
26
     * Checks if amount is zero.
27
     *
28
     * @param string $amount
29
     *
30
     * @return bool
31
     */
32 2
    private static function amountIsZero($amount)
33
    {
34 2
        return $amount == 0;
35
    }
36
37
    /**
38
     * Checks if the deposit is a withdraw.
39
     *
40
     * @param string $description
41
     *
42
     * @return bool
43
     */
44 2
    private static function amountIsWithdrawWithoutNotebook($description)
45
    {
46 2
        return $description == 'Retiro de ahorros sin libreta';
47
    }
48
}
49