Passed
Push — master ( dbab98...43ee99 )
by payever
03:02
created

CancelItemsPaymentRequest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 4
c 1
b 0
f 0
dl 0
loc 14
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A isValid() 0 3 3
1
<?php
2
3
/**
4
 * PHP version 5.4 and 8
5
 *
6
 * @category  RequestEntity
7
 * @package   Payever\Payments
8
 * @author    payever GmbH <[email protected]>
9
 * @copyright 2017-2021 payever GmbH
10
 * @license   MIT <https://opensource.org/licenses/MIT>
11
 * @link      https://docs.payever.org/shopsystems/api/getting-started
12
 */
13
14
namespace Payever\ExternalIntegration\Payments\Http\RequestEntity;
15
16
use Payever\ExternalIntegration\Core\Http\RequestEntity;
17
18
/**
19
 * This class represents Refund Payment items RequestInterface Entity
20
 *
21
 * @method float getDeliveryFee()
22
 * @method self  setDeliveryFee(float $deliveryFee)
23
 * @method float getPaymentItems()
24
 * @method self  setPaymentItems(array $paymentItems)
25
 */
26
class CancelItemsPaymentRequest extends RequestEntity
27
{
28
    /** @var float $deliveryFee */
29
    protected $deliveryFee;
30
31
    /** @var PaymentItemEntity[] $paymentItems */
32
    protected $paymentItems;
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function isValid()
38
    {
39
        return parent::isValid() && (!$this->paymentItems || is_array($this->paymentItems));
0 ignored issues
show
Bug Best Practice introduced by
The expression $this->paymentItems of type Payever\ExternalIntegrat...ity\PaymentItemEntity[] is implicitly converted to a boolean; are you sure this is intended? If so, consider using empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
40
    }
41
}
42