• 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/MAdmin/Job/Item/Standard.php
1
<?php
2

3
/**
4
 * @license LGPLv3, https://opensource.org/licenses/LGPL-3.0
5
 * @copyright Metaways Infosystems GmbH, 2011
6
 * @copyright Aimeos (aimeos.org), 2015-2024
7
 * @package MAdmin
8
 * @subpackage Job
9
 */
10

11

12
namespace Aimeos\MAdmin\Job\Item;
13

14

15
/**
16
 * Default job item implementation.
17
 *
18
 * @package MAdmin
19
 * @subpackage Job
20
 */
21
class Standard
22
        extends \Aimeos\MShop\Common\Item\Base
23
        implements \Aimeos\MAdmin\Job\Item\Iface
24
{
25
        /**
26
         * Initializes the job item.
27
         *
28
         * @param array $values Associative list of key/value pairs
29
         */
30
        public function __construct( array $values = [] )
31
        {
32
                parent::__construct( 'job.', $values );
19✔
33
        }
34

35

36
        /**
37
         * Returns the name of the job item.
38
         *
39
         * @return string Label of the job item
40
         */
41
        public function getLabel() : string
42
        {
43
                return $this->get( 'job.label', '' );
5✔
44
        }
45

46

47
        /**
48
         * Sets the new label of the job item.
49
         *
50
         * @param string|null $label Type label of the job item
51
         * @return \Aimeos\MAdmin\Job\Item\Iface Job item for chaining method calls
52
         */
53
        public function setLabel( ?string $label ) : \Aimeos\MAdmin\Job\Item\Iface
54
        {
55
                return $this->set( 'job.label', (string) $label );
3✔
56
        }
57

58

59
        /**
60
         * Returns the generated file path of the job.
61
         *
62
         * @return string Relative filesystem path to the generated file
63
         */
64
        public function getPath() : string
65
        {
66
                return $this->get( 'job.path', '' );
5✔
67
        }
68

69

70
        /**
71
         * Sets the new generated file path of the job.
72
         *
73
         * @param string|null $path Relative filesystem path to the generated file
74
         * @return \Aimeos\MAdmin\Job\Item\Iface Job item for chaining method calls
75
         */
76
        public function setPath( ?string $path ) : \Aimeos\MAdmin\Job\Item\Iface
77
        {
78
                return $this->set( 'job.path', (string) $path );
3✔
79
        }
80

81

82
        /**
83
         * Returns the status (enabled/disabled) of the job item.
84
         *
85
         * @return int Returns the status of the item
86
         */
87
        public function getStatus() : int
88
        {
89
                return $this->get( 'job.status', 1 );
5✔
90
        }
91

92

93
        /**
94
         * Sets the new status of the job item.
95
         *
96
         * @param int $status Status of the item
97
         * @return \Aimeos\MAdmin\Job\Item\Iface Job item for chaining method calls
98
         */
99
        public function setStatus( int $status ) : \Aimeos\MShop\Common\Item\Iface
100
        {
101
                return $this->set( 'job.status', $status );
2✔
102
        }
103

104

105
        /**
106
         * Sets the item values from the given array and removes that entries from the list
107
         *
108
         * @param array &$list Associative list of item keys and their values
109
         * @param bool True to set private properties too, false for public only
110
         * @return \Aimeos\MAdmin\Job\Item\Iface Job item for chaining method calls
111
         */
112
        public function fromArray( array &$list, bool $private = false ) : \Aimeos\MShop\Common\Item\Iface
113
        {
114
                $item = parent::fromArray( $list, $private );
1✔
115

116
                foreach( $list as $key => $value )
1✔
117
                {
118
                        switch( $key )
119
                        {
120
                                case 'job.path': $item->setPath( (string) $value ); break;
1✔
121
                                case 'job.label': $item->setLabel( (string) $value ); break;
1✔
122
                                case 'job.status': $item->setStatus( (int) $value ); break;
1✔
UNCOV
123
                                default: continue 2;
×
124
                        }
125

126
                        unset( $list[$key] );
1✔
127
                }
128

129
                return $item;
1✔
130
        }
131

132

133
        /**
134
         * Returns the item values as array.
135
         *
136
         * @param bool True to return private properties, false for public only
137
         * @return array Associative list of item properties and their values
138
         */
139
        public function toArray( bool $private = false ) : array
140
        {
141
                $list = parent::toArray( $private );
1✔
142

143
                $list['job.path'] = $this->getPath();
1✔
144
                $list['job.label'] = $this->getLabel();
1✔
145
                $list['job.status'] = $this->getStatus();
1✔
146

147
                return $list;
1✔
148
        }
149

150
}
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