Issues (12)

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/Requests/Label.php (6 issues)

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
2
3
namespace OceanApplications\Postmen\Requests;
4
5
use OceanApplications\Postmen\Models\Billing;
6
use OceanApplications\Postmen\Models\Customs;
7
use OceanApplications\Postmen\Models\Invoice;
8
use OceanApplications\Postmen\Models\Model;
9
use OceanApplications\Postmen\Models\Money;
10
use OceanApplications\Postmen\Models\Shipment;
11
12
class Label extends Model
13
{
14
    public $paper_size = 'default';
15
    public $service_type;
16
    public $is_document = false;
17
    public $shipper_account;
18
    public $shipment;
19
    public $async = false;
20
    public $return_shipment = false;
21
    public $ship_date;
22
    public $service_options = null;
23
    public $invoice;
24
    public $references;
25
    public $billing;
26
    public $customs;
27
28
    public function __construct()
29
    {
30
        $this->ship_date = date('Y-m-d', strtotime('tomorrow'));
31
    }
32
33
    /**
34
     * @param string $size
35
     *
36
     * @return $this
37
     */
38
    public function paper_size($size = 'default')
39
    {
40
        $this->paper_size = $size;
41
42
        return $this;
43
    }
44
45
    /**
46
     * @param $service
47
     *
48
     * @return $this
49
     */
50
    public function service_type($service)
51
    {
52
        $this->service_type = $service;
53
54
        return $this;
55
    }
56
57
    /**
58
     * @param bool $value
59
     *
60
     * @return $this
61
     */
62
    public function is_document($value = true)
63
    {
64
        if ($value == true) {
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
65
            $$this->is_document = true;
66
        } elseif ($value == false) {
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
67
            $this->is_document = false;
68
        }
69
70
        return $this;
71
    }
72
73
    /**
74
     * @param $id
75
     *
76
     * @return $this
77
     */
78
    public function shipper_account($id)
79
    {
80
        $shipper_account = new \stdClass();
81
        $shipper_account->id = $id;
82
        $this->shipper_account = $shipper_account;
83
84
        return $this;
85
    }
86
87
    /**
88
     * @param Shipment $shipment
89
     *
90
     * @return $this
91
     */
92
    public function shipment(Shipment $shipment)
93
    {
94
        $this->shipment = $shipment;
95
96
        return $this;
97
    }
98
99
    /**
100
     * @param bool $value
101
     *
102
     * @return $this
103
     */
104
    public function async($value = true)
105
    {
106
        if ($value == true) {
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
107
            $$this->async = true;
108
        } elseif ($value == false) {
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
109
            $this->async = false;
110
        }
111
112
        return $this;
113
    }
114
115
    /**
116
     * @param bool $value
117
     *
118
     * @return $this
119
     */
120
    public function return_shipment($value = true)
121
    {
122
        if ($value == true) {
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
123
            $$this->return_shipment = true;
124
        } elseif ($value == false) {
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
125
            $this->return_shipment = false;
126
        }
127
128
        return $this;
129
    }
130
131
    /**
132
     * @param $value YYYY-MM-DD formatted date
133
     *
134
     * @return $this
135
     */
136
    public function ship_date($value)
137
    {
138
        $this->ship_date = $value;
139
140
        return $this;
141
    }
142
143
    /**
144
     * @param Money $money
145
     *
146
     * @return $this
147
     */
148
    public function COD(Money $money)
149
    {
150
        if ($this->service_options == null) {
151
            $this->service_options = [];
152
        }
153
        $option = new \stdClass();
154
        $option->type = 'cod';
155
        $option->cod_value = $money;
156
        array_push($this->service_options, $option);
157
158
        return $this;
159
    }
160
161
    /**
162
     * @param Invoice $invoice
163
     *
164
     * @return $this
165
     */
166
    public function invoice(Invoice $invoice)
167
    {
168
        $this->invoice = $invoice;
169
170
        return $this;
171
    }
172
173
    /**
174
     * @param array $references
175
     *
176
     * @return $this
177
     */
178
    public function references(array $references)
179
    {
180
        $this->references = $references;
181
182
        return $this;
183
    }
184
185
    public function billing(Billing $billing)
186
    {
187
        $this->billing = $billing;
188
189
        return $this;
190
    }
191
192
    /**
193
     * @param Customs $customs
194
     *
195
     * @return $this
196
     */
197
    public function customs(Customs $customs)
198
    {
199
        $this->customs = $customs;
200
201
        return $this;
202
    }
203
}
204