Issues (3099)

Security Analysis    not enabled

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/Kunstmaan/SeoBundle/Helper/Order.php (2 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 Kunstmaan\SeoBundle\Helper;
4
5
/**
6
 * Simple helper class to do E-Commerce Tracking.
7
 * Create one of these objects and pass it along to the google_analytics_ecommerce_tracking Twig function.
8
 * It'll create the correct calls to the GA script for you.
9
 *
10
 * API: https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingEcommerce?hl=nl
11
 *
12
 * Class Order
13
 */
14
class Order
15
{
16
    /**
17
     * @var string REQUIRED! The unique identifier for this Order/Transaction
18
     */
19
    protected $transactionID;
20
21
    /**
22
     * @param int $id number The ID
23
     *
24
     * @return $this
25
     */
26
    public function setTransactionID($id)
27
    {
28
        $this->transactionID = $id;
0 ignored issues
show
Documentation Bug introduced by
The property $transactionID was declared of type string, but $id is of type integer. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
29
30
        return $this;
31
    }
32
33
    /**
34
     * @return string
35
     */
36
    public function getTransactionID()
37
    {
38
        return $this->transactionID;
39
    }
40
41
    /**
42
     * @var string the name of the store that handled the Order/Transaction
43
     */
44
    protected $storeName = '';
45
46
    /**
47
     * @param string $name The name of the store
48
     *
49
     * @return $this
50
     */
51
    public function setStoreName($name)
52
    {
53
        $this->storeName = $name;
54
55
        return $this;
56
    }
57
58
    /**
59
     * @return string
60
     */
61
    public function getStoreName()
62
    {
63
        return $this->storeName;
64
    }
65
66
    /**
67
     * REQUIREd!
68
     *
69
     * @return string The total. Calculated automatically and returned as string.
0 ignored issues
show
Should the return type not be string|integer?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
70
     */
71
    public function getTotal()
72
    {
73
        return $this->accumulatePropertyOnOrderItems('getValue');
74
    }
75
76
    /**
77
     * @return int|string
78
     */
79
    public function getTaxesTotal()
80
    {
81
        return $this->accumulatePropertyOnOrderItems('getTaxes');
82
    }
83
84
    protected $shippingTotal = '';
85
86
    /**
87
     * @param $total string|number
88
     *
89
     * @return $this
90
     */
91
    public function setShippingTotal($total)
92
    {
93
        $this->shippingTotal = (float) $total;
94
95
        return $this;
96
    }
97
98
    /**
99
     * @return string
100
     */
101
    public function getShippingTotal()
102
    {
103
        return $this->shippingTotal;
104
    }
105
106
    /**
107
     * @var array(of OrderItem) An array of OrderItem objects
108
     */
109
    public $orderItems = array();
110
111
    /**
112
     * @var string city the order was shipped to
113
     */
114
    protected $city = '';
115
116
    /**
117
     * @param string $city
118
     *
119
     * @return $this
120
     */
121
    public function setCity($city)
122
    {
123
        $this->city = $city;
124
125
        return $this;
126
    }
127
128
    /**
129
     * @return string
130
     */
131
    public function getCity()
132
    {
133
        return $this->city;
134
    }
135
136
    /**
137
     * @var string state or province the order was shipped to
138
     */
139
    protected $stateOrProvince = '';
140
141
    /**
142
     * @param string $stateOrProvince
143
     *
144
     * @return $this
145
     */
146
    public function setStateOrProvince($stateOrProvince)
147
    {
148
        $this->stateOrProvince = $stateOrProvince;
149
150
        return $this;
151
    }
152
153
    /**
154
     * @return string
155
     */
156
    public function getStateOrProvince()
157
    {
158
        return $this->stateOrProvince;
159
    }
160
161
    /**
162
     * @var string country the order was shipped to
163
     */
164
    protected $country = '';
165
166
    /**
167
     * @param string $country
168
     *
169
     * @return $this
170
     */
171
    public function setCountry($country)
172
    {
173
        $this->country = $country;
174
175
        return $this;
176
    }
177
178
    /**
179
     * @return string
180
     */
181
    public function getCountry()
182
    {
183
        return $this->country;
184
    }
185
186
    /**
187
     * Loops over the OrderItems and accumulates the value of the given property. Can also be a getter.
188
     *
189
     * @param $property
190
     *
191
     * @return int|string
192
     */
193
    private function accumulatePropertyOnOrderItems($property)
194
    {
195
        if (\count($this->orderItems) == 0) {
196
            return '';
197
        }
198
199
        $total = 0;
200
        foreach ($this->orderItems as $orderItem) {
201
            $total += $orderItem->$property();
202
        }
203
204
        return $total;
205
    }
206
}
207