Install_Helper_Currency::createWithExchangeRates()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 11
nc 1
nop 0
dl 0
loc 16
rs 9.4285
c 0
b 0
f 0
1
<?php
2
class Install_Helper_Currency
3
{
4
    private $kernel;
5
    private $db;
6
7
    public function __construct($kernel, $db)
8
    {
9
        $this->kernel = $kernel;
10
        $this->db = $db;
11
        Intraface_Doctrine_Intranet::singleton(1);
12
    }
13
14 View Code Duplication
    public function create()
0 ignored issues
show
Duplication introduced by
This method 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...
15
    {
16
        $currency = new Intraface_modules_currency_Currency;
17
        $type = new Intraface_modules_currency_Currency_Type;
18
        $currency->setType($type->getByIsoCode('EUR'));
19
        $currency->save();
20
21
        return $currency;
22
    }
23
24
    public function createWithExchangeRates()
25
    {
26
        $currency = $this->create();
27
28
        $product_price = new Intraface_modules_currency_Currency_ExchangeRate_ProductPrice;
29
        $product_price->setRate(new Ilib_Variable_Float('745,23', 'da_dk'));
30
        $product_price->setCurrency($currency);
31
        $product_price->save();
32
33
        $payment = new Intraface_modules_currency_Currency_ExchangeRate_Payment;
34
        $payment->setRate(new Ilib_Variable_Float('745,23', 'da_dk'));
35
        $payment->setCurrency($currency);
36
        $payment->save();
37
38
        return $currency;
39
    }
40
}