addSessionstatusItem()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/**
3
 *
4
 * NOTICE OF LICENSE
5
 *
6
 * This source file is subject to the GNU General Public License (GPL 3)
7
 * that is bundled with this package in the file LICENSE.txt
8
 *
9
 * DISCLAIMER
10
 *
11
 * Do not edit or add to this file if you wish to upgrade Payone to newer
12
 * versions in the future. If you wish to customize Payone for your
13
 * needs please refer to http://www.payone.de for more information.
14
 *
15
 * @category        Payone
16
 * @package         Payone_SessionStatus
17
 * @copyright       Copyright (c) 2012 <[email protected]> - www.noovias.com
18
 * @author          Matthias Walter <[email protected]>
19
 * @license         <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
20
 * @link            http://www.noovias.com
21
 */
22 View Code Duplication
class Payone_SessionStatus_Request extends Payone_SessionStatus_Request_Abstract
0 ignored issues
show
Duplication introduced by
This class 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...
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