• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

aimeos / aimeos-core / 18a2821b-9fed-4e27-8151-60c5375acb47

16 Aug 2024 11:47AM UTC coverage: 91.965% (-0.002%) from 91.967%
18a2821b-9fed-4e27-8151-60c5375acb47

push

circleci

aimeos
Removed unnecessary assignments in fromArray()

278 of 279 new or added lines in 40 files covered. (99.64%)

30 existing lines in 30 files now uncovered.

10244 of 11139 relevant lines covered (91.97%)

61.77 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.0
/src/MShop/Order/Item/Status/Standard.php
1
<?php
2
/**
3
 * @license LGPLv3, https://opensource.org/licenses/LGPL-3.0
4
 * @copyright Aimeos (aimeos.org), 2015-2024
5
 * @package MShop
6
 * @subpackage Order
7
 */
8

9

10
namespace Aimeos\MShop\Order\Item\Status;
11

12

13
/**
14
 * Default implementation of the order status object.
15
 *
16
 * @package MShop
17
 * @subpackage Order
18
 */
19
class Standard
20
        extends \Aimeos\MShop\Order\Item\Status\Base
21
        implements \Aimeos\MShop\Order\Item\Status\Iface
22
{
23
        /**
24
         * Returns the parentid of the order status.
25
         *
26
         * @return string|null Parent ID of the order
27
         */
28
        public function getParentId() : ?string
29
        {
30
                return $this->get( 'order.status.parentid' );
7✔
31
        }
32

33

34
        /**
35
         * Sets the parentid of the order status.
36
         *
37
         * @param string|null $parentid Parent ID of the order status
38
         * @return \Aimeos\MShop\Order\Item\Status\Iface Order status item for chaining method calls
39
         */
40
        public function setParentId( ?string $parentid ) : \Aimeos\MShop\Common\Item\Iface
41
        {
42
                return $this->set( 'order.status.parentid', $parentid );
13✔
43
        }
44

45

46
        /**
47
         * Returns the type of the order status.
48
         *
49
         * @return string Type of the order status
50
         */
51
        public function getType() : string
52
        {
53
                return $this->get( 'order.status.type', '' );
7✔
54
        }
55

56

57
        /**
58
         * Sets the type of the order status.
59
         *
60
         * @param string $type Type of the order status
61
         * @return \Aimeos\MShop\Order\Item\Status\Iface Order status item for chaining method calls
62
         */
63
        public function setType( string $type ) : \Aimeos\MShop\Common\Item\Iface
64
        {
65
                return $this->set( 'order.status.type', $this->checkCode( $type ) );
6✔
66
        }
67

68

69
        /**
70
         * Returns the value of the order status.
71
         *
72
         * @return string Value of the order status
73
         */
74
        public function getValue() : string
75
        {
76
                return (string) $this->get( 'order.status.value', '' );
11✔
77
        }
78

79

80
        /**
81
         * Sets the value of the order status.
82
         *
83
         * @param string $value Value of the order status
84
         * @return \Aimeos\MShop\Order\Item\Status\Iface Order status item for chaining method calls
85
         */
86
        public function setValue( string $value ) : \Aimeos\MShop\Order\Item\Status\Iface
87
        {
88
                return $this->set( 'order.status.value', $value );
6✔
89
        }
90

91

92
        /*
93
         * Sets the item values from the given array and removes that entries from the list
94
         *
95
         * @param array &$list Associative list of item keys and their values
96
         * @param bool True to set private properties too, false for public only
97
         * @return \Aimeos\MShop\Order\Item\Status\Iface Order status item for chaining method calls
98
         */
99
        public function fromArray( array &$list, bool $private = false ) : \Aimeos\MShop\Common\Item\Iface
100
        {
101
                $item = parent::fromArray( $list, $private );
1✔
102

103
                foreach( $list as $key => $value )
1✔
104
                {
105
                        switch( $key )
106
                        {
107
                                case 'order.status.parentid': !$private ?: $item->setParentId( $value ); break;
1✔
108
                                case 'order.status.type': $item->setType( $value ); break;
1✔
109
                                case 'order.status.value': $item->setValue( $value ); break;
1✔
UNCOV
110
                                default: continue 2;
×
111
                        }
112

113
                        unset( $list[$key] );
1✔
114
                }
115

116
                return $item;
1✔
117
        }
118

119

120

121
        /**
122
         * Returns the item values as array.
123
         *
124
         * @param bool True to return private properties, false for public only
125
         * @return array Associative list of item properties and their values
126
         */
127
        public function toArray( bool $private = false ) : array
128
        {
129
                $list = parent::toArray( $private );
4✔
130

131
                $list['order.status.type'] = $this->getType();
4✔
132
                $list['order.status.value'] = $this->getValue();
4✔
133

134
                if( $private === true ) {
4✔
135
                        $list['order.status.parentid'] = $this->getParentId();
4✔
136
                }
137

138
                return $list;
4✔
139
        }
140

141
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc