Code Duplication    Length = 13-13 lines in 4 locations

src/Intraface/modules/debtor/DebtorItem.php 2 locations

@@ 127-139 (lines=13) @@
124
     *
125
     * @return object Intraface_modules_product_Variation
126
     */
127
    private function getProductVariation()
128
    {
129
        if (!$this->getProduct()->get('has_variation')) {
130
            throw new Exception('The product must have variation to request variations');
131
        }
132
        if (!$this->product_variation) {
133
            if (intval($this->get('product_variation_id')) == 0) {
134
                throw new Exception('The product variation id is not valid on item '.$this->get('id'));
135
            }
136
            $this->product_variation = $this->product->getVariation($this->get('product_variation_id'));
137
        }
138
        return $this->product_variation;
139
    }
140
141
    /**
142
     * Returns product variation detail loaded from item
@@ 146-158 (lines=13) @@
143
     *
144
     * @return object Intraface_modules_product_Variation_Detail
145
     */
146
    private function getProductVariationDetail()
147
    {
148
        if (!$this->getProduct()->get('has_variation')) {
149
            throw new Exception('The product must have variation to request variations');
150
        }
151
        if (!$this->product_variation_detail) {
152
            if (intval($this->get('product_variation_detail_id')) == 0) {
153
                throw new Exception('The product variation detail id is not valid on item '.$this->get('id'));
154
            }
155
            $this->product_variation_detail = $this->getProductVariation()->getDetail($this->get('product_variation_detail_id'));
156
        }
157
        return $this->product_variation_detail;
158
    }
159
160
    /**
161
     * Returns price of product without vat

src/Intraface/modules/procurement/ProcurementItem.php 2 locations

@@ 126-138 (lines=13) @@
123
     *
124
     * @return object Intraface_modules_product_Variation
125
     */
126
    private function getProductVariation()
127
    {
128
        if (!$this->getProduct()->get('has_variation')) {
129
            throw new Exception('The product must have variation to request variations');
130
        }
131
        if (!$this->product_variation) {
132
            if (intval($this->get('product_variation_id')) == 0) {
133
                throw new Exception('The product variation id is not valid on item '.$this->get('id'));
134
            }
135
            $this->product_variation = $this->product->getVariation($this->get('product_variation_id'));
136
        }
137
        return $this->product_variation;
138
    }
139
140
    /**
141
     * Returns product variation detail loaded from item
@@ 145-157 (lines=13) @@
142
     *
143
     * @return object Intraface_modules_product_Variation_Detail
144
     */
145
    private function getProductVariationDetail()
146
    {
147
        if (!$this->getProduct()->get('has_variation')) {
148
            throw new Exception('The product must have variation to request variations');
149
        }
150
        if (!$this->product_variation_detail) {
151
            if (intval($this->get('product_variation_detail_id')) == 0) {
152
                throw new Exception('The product variation detail id is not valid on item '.$this->get('id'));
153
            }
154
            $this->product_variation_detail = $this->getProductVariation()->getDetail($this->get('product_variation_detail_id'));
155
        }
156
        return $this->product_variation_detail;
157
    }
158
159
    /**
160
     * Returns price of product without vat