Completed
Push — master ( b9769b...30fce5 )
by Tobias
24:02
created

Calculator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 23
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A withSpecifiedPayments() 0 4 1
A withEqualPayments() 0 4 1
1
<?php
2
3
namespace Nyholm\EffectiveInterest;
4
5
/**
6
 * @author Tobias Nyholm <[email protected]>
7
 */
8
class Calculator
9
{
10
    /**
11
     * Get the interest when you know all the payments and their dates. Use this function when you have
12
     * administration fees at the first payment and/or when payments are irregular.
13
     *
14
     * @param int    $principal
15
     * @param string $startDate in format 'YYYY-mm-dd'
16
     * @param array  $payments  array with payment dates and values ['YYYY-mm-dd'=>int]
17
     * @param float  $guess     A guess what the interest may be. Between zero and one. Example 0.045
18
     *
19
     * @return float
20
     */
21
    public function withSpecifiedPayments(int $principal, string $startDate, array $payments, float $guess): float
0 ignored issues
show
Unused Code introduced by
The parameter $principal 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...
Unused Code introduced by
The parameter $startDate 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...
Unused Code introduced by
The parameter $payments 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...
Unused Code introduced by
The parameter $guess 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...
22
    {
23
        return 0.045;
24
    }
25
26
    public function withEqualPayments()
27
    {
28
        // TODO implement NewtonRaphson call.
29
    }
30
}
31