Code Duplication    Length = 18-18 lines in 2 locations

app/Http/Controllers/Front/CartController.php 2 locations

@@ 97-114 (lines=18) @@
94
                    if ($isTaxApply == 1) {
95
                        $tax1 = $this->tax->where('level', 1)->first();
96
                        $tax2 = $this->tax->where('level', 2)->first();
97
                        if ($tax1) {
98
                            $name1 = $tax1->name;
99
                            $rate1 = $tax1->rate;
100
                            $taxCondition1 = new \Darryldecode\Cart\CartCondition([
101
                                'name' => $name1,
102
                                'type' => 'tax',
103
                                'target' => 'item',
104
                                'value' => $rate1 . '%',
105
                            ]);
106
                        } else {
107
                            $taxCondition1 = new \Darryldecode\Cart\CartCondition([
108
                                'name' => $name1,
109
                                'type' => 'tax',
110
                                'target' => 'item',
111
                                'value' => $rate1,
112
                            ]);
113
                        }
114
                        if ($tax2) {
115
                            $name2 = $tax2->name;
116
                            $rate2 = $tax2->rate;
117
                            $taxCondition2 = new \Darryldecode\Cart\CartCondition([
@@ 114-131 (lines=18) @@
111
                                'value' => $rate1,
112
                            ]);
113
                        }
114
                        if ($tax2) {
115
                            $name2 = $tax2->name;
116
                            $rate2 = $tax2->rate;
117
                            $taxCondition2 = new \Darryldecode\Cart\CartCondition([
118
                                'name' => $name2,
119
                                'type' => 'tax',
120
                                'target' => 'item',
121
                                'value' => $rate2 . '%',
122
                            ]);
123
                        } else {
124
                            $taxCondition2 = new \Darryldecode\Cart\CartCondition([
125
                                'name' => $name2,
126
                                'type' => 'tax',
127
                                'target' => 'item',
128
                                'value' => $rate2,
129
                            ]);
130
                        }
131
                    } else {
132
                        $taxCondition1 = new \Darryldecode\Cart\CartCondition([
133
                            'name' => $name1,
134
                            'type' => 'tax',