Code Duplication    Length = 79-80 lines in 2 locations

lib/Payone/Api/Request/Parameter/Vauthorization/Invoicing/Transaction.php 1 location

@@ 33-112 (lines=80) @@
30
 * @license         <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
31
 * @link            http://www.noovias.com
32
 */
33
class Payone_Api_Request_Parameter_Vauthorization_Invoicing_Transaction
34
    extends Payone_Api_Request_Parameter_Abstract
35
{
36
    /**
37
     * @var string
38
     */
39
    protected $invoice_deliverymode = NULL;
40
41
42
    /**
43
     * @var Payone_Api_Request_Parameter_Invoicing_Item[]
44
     */
45
    protected $items = array();
46
47
    public function toArray()
48
    {
49
        $data = parent::toArray();
50
51
        $i = 1;
52
        foreach ($this->items as $key => $item) {
53
            /**
54
             * @var $item Payone_Api_Request_Parameter_Invoicing_Item
55
             */
56
57
            $data = array_merge($data, $item->toArrayByKey($i));
58
59
            $i++;
60
        }
61
62
        return $data;
63
    }
64
65
    /**
66
     * @return bool
67
     */
68
    public function hasItems()
69
    {
70
        return count($this->items) ? true : false;
71
    }
72
73
    /**
74
     * @param Payone_Api_Request_Parameter_Invoicing_Item $item
75
     */
76
    public function addItem(Payone_Api_Request_Parameter_Invoicing_Item $item)
77
    {
78
        $this->items[] = $item;
79
    }
80
81
    /**
82
     * @param Payone_Api_Request_Parameter_Invoicing_Item[] $items
83
     */
84
    public function setItems($items)
85
    {
86
        $this->items = $items;
87
    }
88
89
    /**
90
     * @return Payone_Api_Request_Parameter_Invoicing_Item[]
91
     */
92
    public function getItems()
93
    {
94
        return $this->items;
95
    }
96
97
    /**
98
     * @param string $invoice_deliverymode
99
     */
100
    public function setInvoiceDeliverymode($invoice_deliverymode)
101
    {
102
        $this->invoice_deliverymode = $invoice_deliverymode;
103
    }
104
105
    /**
106
     * @return string
107
     */
108
    public function getInvoiceDeliverymode()
109
    {
110
        return $this->invoice_deliverymode;
111
    }
112
}
113

lib/Payone/SessionStatus/Request.php 1 location

@@ 22-100 (lines=79) @@
19
 * @license         <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
20
 * @link            http://www.noovias.com
21
 */
22
class Payone_SessionStatus_Request extends Payone_SessionStatus_Request_Abstract
23
{
24
    /**
25
     * @var string Payment portal key as MD5 value
26
     */
27
    protected $key = NULL;
28
29
    /**
30
     * @var Payone_SessionStatus_Request_Item[]
31
     */
32
    //@todo cw: use correct name $sessionStatusItems
33
    protected $sessionStatusItems = array();
34
35
    public function toArray()
36
    {
37
        $data = parent::toArray();
38
39
        $i = 0;
40
        foreach ($this->getSessionStatusItems() as $key => $item) {
41
            /** @var $item Payone_SessionStatus_Request_Item */
42
43
            $data = array_merge($data, $item->toArrayByKey($i));
44
45
            $i++;
46
        }
47
48
        //unset mapped item
49
        unset($data['sessionStatusItems']);
50
51
        return $data;
52
    }
53
54
    /**
55
     * @param string $key
56
     */
57
    public function setKey($key)
58
    {
59
        $this->key = $key;
60
    }
61
62
    /**
63
     * @return string
64
     */
65
    public function getKey()
66
    {
67
        return $this->key;
68
    }
69
70
    /**
71
     * @param \Payone_SessionStatus_Request_Item[] $sessionstatus_items
72
     */
73
    public function setSessionStatusItems($sessionstatus_items)
74
    {
75
        $this->sessionStatusItems = $sessionstatus_items;
76
    }
77
78
    /**
79
     * @return \Payone_SessionStatus_Request_Item[]
80
     */
81
    public function getSessionStatusItems()
82
    {
83
        return $this->sessionStatusItems;
84
    }
85
86
    /**
87
     * @return bool
88
     */
89
    public function hasSessionstatusItems()
90
    {
91
        return count($this->sessionStatusItems) ? true : false;
92
    }
93
94
    /**
95
     * @param Payone_SessionStatus_Request_Item $item
96
     */
97
    public function addSessionstatusItem(Payone_SessionStatus_Request_Item $item)
98
    {
99
        $this->sessionStatusItems[] = $item;
100
    }
101
}
102