Issues (43)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/SimpleUPS/Rates/Package.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php namespace SimpleUPS\Rates;
2
3
4
/**
5
 * Default
6
 * @since 1.0
7
 */
8
9
class Package extends \SimpleUPS\Package
10
{
11
    const
12
        TYPE_UNKNOWN = '00',
13
        TYPE_UPS_LETTER = '01',
14
        TYPE_PACKAGE = '02',
15
        TYPE_TUBE = '03',
16
        TYPE_PAK = '04',
17
        TYPE_EXPRESS_BOX = '21',
18
        TYPE_25KG_BOX = '24',
19
        TYPE_10KG_BOX = '25',
20
        TYPE_PALLET = '30',
21
        TYPE_SMALL_EXPRESS_BOX = '2a',
22
        TYPE_MEDIUM_EXPRESS_BOX = '2b',
23
        TYPE_LARGE_EXPRESS_BOX = '2c';
24
25
    private
26
        /* @var string $unitOfMeasurement */
27
        $unitOfMeasurement = 'IN',
28
29
        /* @var string $type */
30
        $type,
31
        /* @var float $length */
32
        $length,
33
34
        /* @var float $width */
35
        $width,
36
37
        /* @var float $height */
38
        $height,
39
40
        /* @var float $insuranceAmount */
41
        $insuranceAmount;
42
43
    private static
44
        $MEASUREMENT_INCHES = 'IN',
45
        $MEASUREMENT_CENTIMETERS = 'CM';
46
47
    public function __construct()
48
    {
49
        $this->measurement = self::$MEASUREMENT_INCHES;
0 ignored issues
show
The property measurement does not seem to exist. Did you mean unitOfMeasurement?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
50
    }
51
52
    /**
53
     * Define this package as the dimensions being measured in inches
54
     */
55
    public function measuredInCentimeters()
56
    {
57
        $this->setUnitOfMeasurement(self::$MEASUREMENT_CENTIMETERS);
58
    }
59
60
    /**
61
     * @param string $unitOfMeasurement
62
     *
63
     * @return Package
64
     */
65
    private function setUnitOfMeasurement($unitOfMeasurement)
66
    {
67
        $this->unitOfMeasurement = $unitOfMeasurement;
68
        return $this;
69
    }
70
71
    /**
72
     * @return string
73
     */
74
    private function getUnitOfMeasurement()
75
    {
76
        return $this->unitOfMeasurement;
77
    }
78
79
    /**
80
     * Defines the type of package.  "TYPE_PACKAGE" is default.  Refer to class constants for possible values
81
     *
82
     * @param string $type
83
     *
84
     * @return Package
85
     */
86
    public function setType($type)
87
    {
88
        $this->type = $type;
89
        return $this;
90
    }
91
92
    /**
93
     * @return float
94
     */
95
    public function getType()
96
    {
97
        return $this->type;
98
    }
99
100
    /**
101
     * @param float $height
102
     *
103
     * @return Package
104
     */
105
    public function setHeight($height)
106
    {
107
        $this->height = $height;
108
        return $this;
109
    }
110
111
    /**
112
     * @return float
113
     */
114
    public function getHeight()
115
    {
116
        return $this->height;
117
    }
118
119
    /**
120
     * @param float $length
121
     *
122
     * @return Package
123
     */
124
    public function setLength($length)
125
    {
126
        $this->length = $length;
127
        return $this;
128
    }
129
130
    /**
131
     * @return float
132
     */
133
    public function getLength()
134
    {
135
        return $this->length;
136
    }
137
138
    /**
139
     * @param float $width
140
     *
141
     * @return Package
142
     */
143
    public function setWidth($width)
144
    {
145
        $this->width = $width;
146
        return $this;
147
    }
148
149
    /**
150
     * @return float
151
     */
152
    public function getWidth()
153
    {
154
        return $this->width;
155
    }
156
157
    /**
158
     * @internal
159
     *
160
     * @param \DomDocument $dom
161
     *
162
     * @return \DOMElement
163
     * @throw \SimpleUPS\Api\MissingParameterException
164
     */
165
    public function toXml(\DomDocument $dom)
166
    {
167
        $package = $dom->createElement('Package');
168
169
        if ($this->getType() == null) {
170
            $this->setType(Package::TYPE_PACKAGE);
171
        }
172
173
        $package->appendChild($packagingType = $dom->createElement('PackagingType'));
174
        $packagingType->appendChild($dom->createElement('Code', $this->getType()));
175
176
        if ($this->getLength() != null || $this->getHeight() != null || $this->getWidth() != null) {
177
            $package->appendChild($dimensions = $dom->createElement('Dimensions'));
178
            $unitOfMeasurement = $dimensions->appendChild($dom->createElement('UnitOfMeasurement'));
179
            $unitOfMeasurement->appendChild($dom->createElement('Code', $this->getUnitOfMeasurement()));
180
181
            if ($this->getType() != Package::TYPE_UPS_LETTER &&
182
                $this->getType() != Package::TYPE_TUBE &&
183
                $this->getType() != Package::TYPE_EXPRESS_BOX
184
            ) {
185
186
                if ($this->getLength() != null) {
187
                    $dimensions->appendChild($dom->createElement('Length', $this->getLength()));
188
                }
189
190
                if ($this->getHeight() != null) {
191
                    $dimensions->appendChild($dom->createElement('Height', $this->getHeight()));
192
                }
193
194
                if ($this->getWidth() != null) {
195
                    $dimensions->appendChild($dom->createElement('Width', $this->getWidth()));
196
                }
197
            }
198
        }
199
200
        if ($this->getWeight() != null) {
201
            $package->appendChild($this->getWeight()->toXml($dom));
202
        }
203
204
        return $package;
205
    }
206
}