newAnnualCouponsBond()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 11
Ratio 100 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 11
loc 11
rs 9.4285
cc 1
eloc 6
nc 1
nop 4
1
<?php
2
3
namespace FinanCalc\Calculators\Factories {
4
5
    use FinanCalc\Calculators\BondFairValueCalculator;
6
    use FinanCalc\Interfaces\Calculator\CalculatorFactoryAbstract;
7
8
9
    /**
10
     * Class BondFairValueCalculatorFactory
11
     * @package FinanCalc\Calculators\Factories
12
     */
13 View Code Duplication
    class BondFairValueCalculatorFactory extends CalculatorFactoryAbstract
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
14
    {
15
        const MANUFACTURED_CLASS_NAME = 'FinanCalc\\Calculators\\BondFairValueCalculator';
16
17
        /**
18
         * @param $bondFaceValue
19
         * @param $bondAnnualCouponRate
20
         * @param $bondVIR
21
         * @param $bondYearsToMaturity
22
         * @return BondFairValueCalculator
23
         */
24
        public function newAnnualCouponsBond($bondFaceValue, $bondAnnualCouponRate, $bondVIR, $bondYearsToMaturity)
25
        {
26
            return $this->manufactureInstance(
27
                [
28
                    $bondFaceValue,
29
                    $bondAnnualCouponRate,
30
                    $bondVIR,
31
                    $bondYearsToMaturity
32
                ]
33
            );
34
        }
35
36
        /**
37
         * @param $bondFaceValue
38
         * @param $bondAnnualCouponRate
39
         * @param $bondVIR
40
         * @param $bondYearsToMaturity
41
         * @return BondFairValueCalculator
42
         */
43
        public function newSemiAnnualCouponsBond($bondFaceValue, $bondAnnualCouponRate, $bondVIR, $bondYearsToMaturity)
44
        {
45
            return $this->manufactureInstance(
46
                [
47
                    $bondFaceValue,
48
                    $bondAnnualCouponRate,
49
                    $bondVIR,
50
                    $bondYearsToMaturity,
51
                    2
52
                ]
53
            );
54
        }
55
56
        /**
57
         * @param $bondFaceValue
58
         * @param $bondAnnualCouponRate
59
         * @param $bondVIR
60
         * @param $bondYearsToMaturity
61
         * @return BondFairValueCalculator
62
         */
63
        public function newQuarterlyCouponsBond($bondFaceValue, $bondAnnualCouponRate, $bondVIR, $bondYearsToMaturity)
64
        {
65
            return $this->manufactureInstance(
66
                [
67
                    $bondFaceValue,
68
                    $bondAnnualCouponRate,
69
                    $bondVIR,
70
                    $bondYearsToMaturity,
71
                    4
72
                ]
73
            );
74
        }
75
76
        /**
77
         * @param $bondFaceValue
78
         * @param $bondAnnualCouponRate
79
         * @param $bondVIR
80
         * @param $bondYearsToMaturity
81
         * @return BondFairValueCalculator
82
         */
83
        public function newMonthlyCouponsBond($bondFaceValue, $bondAnnualCouponRate, $bondVIR, $bondYearsToMaturity)
84
        {
85
            return $this->manufactureInstance(
86
                [
87
                    $bondFaceValue,
88
                    $bondAnnualCouponRate,
89
                    $bondVIR,
90
                    $bondYearsToMaturity,
91
                    12
92
                ]
93
            );
94
        }
95
96
        /**
97
         * @param $bondFaceValue
98
         * @param $bondAnnualCouponRate
99
         * @param $bondVIR
100
         * @param $bondYearsToMaturity
101
         * @param $bondPaymentFrequency
102
         * @return BondFairValueCalculator
103
         */
104
        public function newCustomCouponFrequencyBond(
105
            $bondFaceValue,
106
            $bondAnnualCouponRate,
107
            $bondVIR,
108
            $bondYearsToMaturity,
109
            $bondPaymentFrequency
110
        ) {
111
            return $this->manufactureInstance(
112
                [
113
                    $bondFaceValue,
114
                    $bondAnnualCouponRate,
115
                    $bondVIR,
116
                    $bondYearsToMaturity,
117
                    $bondPaymentFrequency
118
                ]
119
            );
120
        }
121
    }
122
}
123