GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Charge::serializeContents()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * Copyright (c) 2013-2014 eBay Enterprise, Inc.
4
 *
5
 * NOTICE OF LICENSE
6
 *
7
 * This source file is subject to the Open Software License (OSL 3.0)
8
 * that is bundled with this package in the file LICENSE.md.
9
 * It is also available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * @copyright   Copyright (c) 2013-2015 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
13
 * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
14
 */
15
16
namespace eBayEnterprise\RetailOrderManagement\Payload\Order\Detail;
17
18
use eBayEnterprise\RetailOrderManagement\Payload\IPayload;
19
use eBayEnterprise\RetailOrderManagement\Payload\IPayloadMap;
20
use eBayEnterprise\RetailOrderManagement\Payload\ISchemaValidator;
21
use eBayEnterprise\RetailOrderManagement\Payload\IValidatorIterator;
22
use eBayEnterprise\RetailOrderManagement\Payload\TPayload;
23
use eBayEnterprise\RetailOrderManagement\Payload\PayloadFactory;
24
use Psr\Log\LoggerInterface;
25
use Psr\Log\NullLogger;
26
27
class Charge implements ICharge
28
{
29
    use TPayload;
30
31
    /** @var string */
32
    protected $name;
33
    /** @var string */
34
    protected $category;
35
    /** @var bool */
36
    protected $isDiscount;
37
    /** @var bool */
38
    protected $isPromotion;
39
    /** @var string */
40
    protected $informational;
41
    /** @var float */
42
    protected $unitPrice;
43
    /** @var float */
44
    protected $linePrice;
45
    /** @var float */
46
    protected $amount;
47
48
    /**
49
     * @param IValidatorIterator
50
     * @param ISchemaValidator
51
     * @param IPayloadMap
52
     * @param LoggerInterface
53
     * @param IPayload
54
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
55
     */
56
    public function __construct(
57
        IValidatorIterator $validators,
58
        ISchemaValidator $schemaValidator,
59
        IPayloadMap $payloadMap,
60
        LoggerInterface $logger,
61
        IPayload $parentPayload = null
62
    ) {
63
        $this->logger = $logger;
0 ignored issues
show
Documentation Bug introduced by
It seems like $logger of type object<Psr\Log\LoggerInterface> is incompatible with the declared type object<eBayEnterprise\Re...ayload\LoggerInterface> of property $logger.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
64
        $this->validators = $validators;
65
        $this->schemaValidator = $schemaValidator;
66
        $this->parentPayload = $parentPayload;
67
        $this->payloadMap = $payloadMap;
68
        $this->payloadFactory = $this->getNewPayloadFactory();
69
        $this->initOptionalExtractPaths();
70
    }
71
72
    /**
73
     * Initialize the protected class property array self::optionalExtractionPaths with xpath
74
     * key/value pairs.
75
     *
76
     * @return self
77
     */
78
    protected function initOptionalExtractPaths()
79
    {
80
        $this->optionalExtractionPaths = [
81
            'name' => '@name',
82
            'category' => '@category',
83
            'isDiscount' => '@isDiscount',
84
            'isPromotion' => '@isPromotion',
85
            'informational' => '@informational',
86
            'unitPrice' => '@unitPrice',
87
            'linePrice' => '@linePrice',
88
            'amount' => '@amount',
89
        ];
90
        return $this;
91
    }
92
93
    /**
94
     * @see ICharge::getName()
95
     */
96
    public function getName()
97
    {
98
        return $this->name;
99
    }
100
101
    /**
102
     * @see ICharge::setName()
103
     * @codeCoverageIgnore
104
     */
105
    public function setName($name)
106
    {
107
        $this->name = $name;
108
        return $this;
109
    }
110
111
    /**
112
     * @see ICharge::getCategory()
113
     */
114
    public function getCategory()
115
    {
116
        return $this->category;
117
    }
118
119
    /**
120
     * @see ICharge::setCategory()
121
     * @codeCoverageIgnore
122
     */
123
    public function setCategory($category)
124
    {
125
        $this->category = $category;
126
        return $this;
127
    }
128
129
    /**
130
     * @see ICharge::getIsDiscount()
131
     */
132
    public function getIsDiscount()
133
    {
134
        return $this->isDiscount;
135
    }
136
137
    /**
138
     * @see ICharge::setIsDiscount()
139
     * @codeCoverageIgnore
140
     */
141
    public function setIsDiscount($isDiscount)
142
    {
143
        $this->isDiscount = $isDiscount;
144
        return $this;
145
    }
146
147
    /**
148
     * @see ICharge::getIsPromotion()
149
     */
150
    public function getIsPromotion()
151
    {
152
        return $this->isPromotion;
153
    }
154
155
    /**
156
     * @see ICharge::setIsPromotion()
157
     * @codeCoverageIgnore
158
     */
159
    public function setIsPromotion($isPromotion)
160
    {
161
        $this->isPromotion = $isPromotion;
162
        return $this;
163
    }
164
165
    /**
166
     * @see ICharge::getInformational()
167
     */
168
    public function getInformational()
169
    {
170
        return $this->informational;
171
    }
172
173
    /**
174
     * @see ICharge::setInformational()
175
     * @codeCoverageIgnore
176
     */
177
    public function setInformational($informational)
178
    {
179
        $this->informational = $informational;
180
        return $this;
181
    }
182
183
    /**
184
     * @see ICharge::getUnitPrice()
185
     */
186
    public function getUnitPrice()
187
    {
188
        return $this->unitPrice;
189
    }
190
191
    /**
192
     * @see ICharge::setUnitPrice()
193
     * @codeCoverageIgnore
194
     */
195
    public function setUnitPrice($unitPrice)
196
    {
197
        $this->unitPrice = $unitPrice;
198
        return $this;
199
    }
200
201
    /**
202
     * @see ICharge::getLinePrice()
203
     */
204
    public function getLinePrice()
205
    {
206
        return $this->linePrice;
207
    }
208
209
    /**
210
     * @see ICharge::setLinePrice()
211
     * @codeCoverageIgnore
212
     */
213
    public function setLinePrice($linePrice)
214
    {
215
        $this->linePrice = $linePrice;
216
        return $this;
217
    }
218
219
    /**
220
     * @see ICharge::getAmount()
221
     */
222
    public function getAmount()
223
    {
224
        return $this->amount;
225
    }
226
227
    /**
228
     * @see ICharge::setAmount()
229
     * @codeCoverageIgnore
230
     */
231
    public function setAmount($amount)
232
    {
233
        $this->amount = $amount;
234
        return $this;
235
    }
236
237
    /**
238
     * @see TPayload::serializeContents()
239
     */
240
    protected function serializeContents()
241
    {
242
        return '';
243
    }
244
245
    /**
246
     * @see TPayload::getRootNodeName()
247
     */
248
    protected function getRootNodeName()
249
    {
250
        return static::ROOT_NODE;
251
    }
252
253
    /**
254
     * @see TPayload::getXmlNamespace()
255
     */
256
    protected function getXmlNamespace()
257
    {
258
        return self::XML_NS;
259
    }
260
261
    /**
262
     * @see TPayload::getRootAttributes()
263
     */
264
    protected function getRootAttributes()
265
    {
266
        $name = $this->getName();
267
        $category = $this->getCategory();
268
        $isDiscount = $this->getIsDiscount();
269
        $isPromotion = $this->getIsPromotion();
270
        $informational = $this->getInformational();
271
        $unitPrice = $this->getUnitPrice();
272
        $linePrice = $this->getLinePrice();
273
        $amount = $this->getAmount();
274
        return array_merge(
275
            $name ? ['name' => $name] : [],
276
            $category ? ['category' => $category] : [],
277
            $isDiscount ? ['isDiscount' => $isDiscount] : [],
278
            $isPromotion ? ['isPromotion' => $isPromotion] : [],
279
            $informational ? ['informational' => $informational] : [],
280
            is_numeric($unitPrice) ? ['unitPrice' => $unitPrice] : [],
281
            is_numeric($linePrice) ? ['linePrice' => $linePrice] : [],
282
            is_numeric($amount) ? ['amount' => $amount] : []
283
        );
284
    }
285
}
286