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.

InStorePickUpItem::getStoreFrontName()   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 1
Metric Value
c 1
b 0
f 1
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-2014 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\Inventory;
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\PayloadFactory;
23
use eBayEnterprise\RetailOrderManagement\Payload\TPayload;
24
use eBayEnterprise\RetailOrderManagement\Payload\TIdentity;
25
use eBayEnterprise\RetailOrderManagement\Payload\Checkout\TPhysicalAddress;
26
use eBayEnterprise\RetailOrderManagement\Payload\Payment\TAmount;
27
use Psr\Log\LoggerInterface;
28
29
/**
30
 * Order line item in a checkout inventory API inventory details request or allocation request.
31
 */
32
class InStorePickUpItem implements IInStorePickUpItem
33
{
34
    use TPayload, TItem, TAmount, TOrderItem, TPhysicalAddress {
35
        TPhysicalAddress::getLines as getAddressLines;
36
        TPhysicalAddress::setLines as setAddressLines;
37
        TPhysicalAddress::getCity as getAddressCity;
38
        TPhysicalAddress::setCity as setAddressCity;
39
        TPhysicalAddress::getMainDivision as getAddressMainDivision;
40
        TPhysicalAddress::setMainDivision as setAddressMainDivision;
41
        TPhysicalAddress::getCountryCode as getAddressCountryCode;
42
        TPhysicalAddress::setCountryCode as setAddressCountryCode;
43
        TPhysicalAddress::getPostalCode as getAddressPostalCode;
44
        TPhysicalAddress::setPostalCode as setAddressPostalCode;
45
    }
46
47
    const ROOT_NODE = 'OrderItem';
48
49
    /**
50
     * @param IValidatorIterator
51
     * @param ISchemaValidator
52
     * @param IPayloadMap
53
     * @param LoggerInterface
54
     * @param IPayload
55
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
56
     */
57 View Code Duplication
    public function __construct(
0 ignored issues
show
Duplication introduced by
This method 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...
58
        IValidatorIterator $validators,
59
        ISchemaValidator $schemaValidator,
60
        IPayloadMap $payloadMap,
61
        LoggerInterface $logger,
62
        IPayload $parentPayload = null
63
    ) {
64
        $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...
65
        $this->validators = $validators;
66
        $this->schemaValidator = $schemaValidator;
67
        $this->payloadMap = $payloadMap;
68
        $this->parentPayload = $parentPayload;
69
        $this->payloadFactory = new PayloadFactory;
70
71
        $this->extractionPaths = [
72
            'itemId' => 'string(@itemId)',
73
            'id' => 'string(@lineId)',
74
            'quantity' => 'string(x:Quantity)',
75
            'storeFrontId' => 'string(x:InStorePickupDetails/x:StoreFrontId)',
76
            'storeFrontName' => 'string(x:InStorePickupDetails/x:StoreFrontName)',
77
            'city' => 'string(x:InStorePickupDetails/x:StoreFrontAddress/x:City)',
78
            'countryCode' => 'string(x:InStorePickupDetails/x:StoreFrontAddress/x:CountryCode)',
79
            'shippingMethodCarrierType' => 'string(x:InStorePickupDetails/x:StoreFrontAddress)',
80
        ];
81
        $this->optionalExtractionPaths = [
82
            'mainDivision' => 'x:InStorePickupDetails/x:StoreFrontAddress/x:MainDivision',
83
            'postalCode' => 'x:InStorePickupDetails/x:StoreFrontAddress/x:PostalCode',
84
        ];
85
        $this->booleanExtractionPaths = [
86
            'giftWrapRequested' => 'string(x:GiftwrapRequested)',
87
        ];
88
        $this->addressLinesExtractionMap = [
89
            [
90
                'property' => 'lines',
91
                'xPath' => 'x:InStorePickupDetails/x:StoreFrontAddress/*[starts-with(name(), "Line")]'
92
            ],
93
        ];
94
    }
95
96
    /**
97
     * This is the identifier of the store in which the line item will be picked up.
98
     *
99
     * restrictions: length <= 100
100
     * @return string
101
     */
102
    public function getStoreFrontId()
103
    {
104
        return $this->storeFrontId;
0 ignored issues
show
Bug introduced by
The property storeFrontId does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
105
    }
106
107
    /**
108
     * @param string
109
     * @return self
110
     */
111
    public function setStoreFrontId($id)
112
    {
113
        $this->id = $this->cleanString($id, 100);
114
        return $this;
115
    }
116
117
    /**
118
     * Store Name
119
     *
120
     * restrictions: length <= 100
121
     * @return string
122
     */
123
    public function getStoreFrontName()
124
    {
125
        return $this->storeFrontName;
0 ignored issues
show
Bug introduced by
The property storeFrontName does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
126
    }
127
128
    /**
129
     * @param string
130
     * @return self
131
     */
132
    public function setStoreFrontName($name)
133
    {
134
        $this->name = $this->cleanString($name, 100);
0 ignored issues
show
Bug introduced by
The property name does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
135
        return $this;
136
    }
137
138
    protected function serializeContents()
139
    {
140
        return $this->serializeQuantity()
141
            . "<InStorePickupDetails>"
142
            . "<StoreFrontId>{$this->xmlEncode($this->getStoreFrontId())}</StoreFrontId>"
143
            . "<StoreFrontName>{$this->xmlEncode($this->getStoreFrontName())}</StoreFrontName>"
144
            . $this->serializePhysicalAddress()
145
            . "</InStorePickupDetails>"
146
            . $this->serializeGiftWrapRequested();
147
    }
148
149
    protected function getRootAttributes()
150
    {
151
        return [
152
            'itemId' => $this->getItemId(),
153
            'lineId' => $this->getId(),
154
        ];
155
    }
156
157
    protected function getPhysicalAddressRootNodeName()
158
    {
159
        return 'StoreFrontAddress';
160
    }
161
}
162