Code Duplication    Length = 21-22 lines in 3 locations

install/Helper/Debtor.php 3 locations

@@ 13-33 (lines=21) @@
10
        $this->db = $db;
11
    }
12
13
    public function createInvoice()
14
    {
15
        require_once dirname (__FILE__) . '/Contact.php';
16
        $contact = new Install_Helper_Contact($this->kernel, $this->db);
17
        $contact_id = $contact->create();
18
19
        require_once dirname(__FILE__) . '/Product.php';
20
        $product = new Install_Helper_Product($this->kernel, $this->db);
21
        $product_id = $product->create();
22
23
        require_once 'Intraface/modules/invoice/Invoice.php';
24
        $debtor = new Invoice($this->kernel);
25
        $id = $debtor->update(array(
26
            'contact_id' => $contact_id,
27
            'description' => 'Test invoice',
28
            'this_date' => date('d-m-Y'),
29
            'due_date' => date('d-m-Y', time()+14*60*60*24)));
30
31
        $debtor->loadItem();
32
        $debtor->item->save(array('product_id' => $product_id, 'quantity' => 3, 'description' => 'Test description on product'));
33
    }
34
35
    public function createOrder()
36
    {
@@ 35-55 (lines=21) @@
32
        $debtor->item->save(array('product_id' => $product_id, 'quantity' => 3, 'description' => 'Test description on product'));
33
    }
34
35
    public function createOrder()
36
    {
37
        require_once dirname(__FILE__) . '/Contact.php';
38
        $contact = new Install_Helper_Contact($this->kernel, $this->db);
39
        $contact_id = $contact->create();
40
41
        require_once dirname(__FILE__) . '/Product.php';
42
        $product = new Install_Helper_Product($this->kernel, $this->db);
43
        $product_id = $product->create();
44
45
        require_once 'Intraface/modules/order/Order.php';
46
        $debtor = new Order($this->kernel);
47
        $id = $debtor->update(array(
48
            'contact_id' => $contact_id,
49
            'description' => 'Test invoice',
50
            'this_date' => date('d-m-Y'),
51
            'due_date' => date('d-m-Y', time()+14*60*60*24)));
52
53
        $debtor->loadItem();
54
        $debtor->item->save(array('product_id' => $product_id, 'quantity' => 3, 'description' => 'Test description on product'));
55
    }
56
57
    public function createOrderFromShop()
58
    {
@@ 57-78 (lines=22) @@
54
        $debtor->item->save(array('product_id' => $product_id, 'quantity' => 3, 'description' => 'Test description on product'));
55
    }
56
57
    public function createOrderFromShop()
58
    {
59
        require_once dirname(__FILE__) . '/Contact.php';
60
        $contact = new Install_Helper_Contact($this->kernel, $this->db);
61
        $contact_id = $contact->create();
62
63
        require_once dirname(__FILE__) . '/Product.php';
64
        $product = new Install_Helper_Product($this->kernel, $this->db);
65
        $product_id = $product->create();
66
67
        require_once 'Intraface/modules/order/Order.php';
68
        $debtor = new Order($this->kernel);
69
        $id = $debtor->update(array(
70
            'contact_id' => $contact_id,
71
            'description' => 'From shop',
72
            'this_date' => date('d-m-Y'),
73
            'due_date' => date('d-m-Y', time()+14*60*60*24)), 'webshop', 1);
74
75
        $debtor->loadItem();
76
        $debtor->item->save(array('product_id' => $product_id, 'quantity' => 3, 'description' => 'Test description on product'));
77
78
    }
79
}
80