Issues (14)

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/Journal/Deal.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
0 ignored issues
show
File has mixed line endings; this may cause incorrect results
Loading history...
2
3
namespace Radowoj\Yaah\Journal;
4
5
use stdClass;
6
use InvalidArgumentException;
7
8
/**
9
 * Journal entry for a single Deal event (doGetSiteJournalDeals())
10
 */
11
class Deal implements DealInterface
12
{
13
    /**
14
     * @see http://allegro.pl/webapi/documentation.php/show/id,742#method-output
15
     */
16
    const EVENT_TYPE_CREATE_DEAL = 1;
17
    const EVENT_TYPE_CREATE_POST_SALE_FORM = 2;
18
    const EVENT_TYPE_ABORT_POST_SALE_FORM = 3;
19
    const EVENT_TYPE_FINISH_DEAL = 4;
20
21
    protected $eventId = null;
22
23
    protected $eventType = null;
24
25
    protected $eventTime = null;
26
27
    protected $id = null;
28
29
    protected $transactionId = null;
30
31
    protected $sellerId = null;
32
33
    protected $itemId = null;
34
35
    protected $buyerId = null;
36
37
    protected $quantity = null;
38
39
40 7
    public function __construct(stdClass $deal)
41
    {
42 7
        $this->mapFromObject($deal);
43 5
    }
44
45
46
    /**
47
     * Validate and set a Deal property based on WebAPI's returned object property
48
     * @param string $originalProperty original (WebAPI) property name (i.e. dealEventId)
49
     * @param string $value value
50
     */
51 7
    protected function setProperty($originalProperty, $value)
52
    {
53 7
        if (strpos($originalProperty, 'deal') !== 0) {
54 1
            throw new InvalidArgumentException("Original deal property name must start with \"deal\"");
55
        }
56
57 6
        $localProperty = lcfirst(
58 6
            preg_replace('/^deal/', '', $originalProperty)
59 6
        );
60
61 6
        if (!property_exists($this, $localProperty)) {
62 1
            throw new InvalidArgumentException("Unknown Deal property: {$localProperty}");
63
        }
64
65 5
        $this->{$localProperty} = $value;
66 5
    }
67
68
69
    /**
70
     * Set properties based on WebAPI's returned object
71
     * @param  stdClass $deal deal object returned by doGetSiteJournalDeals()
72
     */
73 7
    protected function mapFromObject(stdClass $deal)
74
    {
75 7
        foreach($deal as $prop => $value) {
0 ignored issues
show
The expression $deal of type object<stdClass> is not traversable.
Loading history...
76 7
            $this->setProperty($prop, $value);
77 5
        }
78 5
    }
79
80
81 1
    public function getEventId()
82
    {
83 1
        return $this->eventId;
84
    }
85
86
87 1
    public function getEventType()
88
    {
89 1
        return $this->eventType;
90
    }
91
92
93 1
    public function getEventTime($dateFormat = 'Y-m-d H:i:s')
94
    {
95 1
        return date($dateFormat, $this->eventTime);
96
    }
97
98
99 1
    public function getId()
100
    {
101 1
        return $this->id;
102
    }
103
104
105 1
    public function getTransactionId()
106
    {
107 1
        return $this->transactionId;
108
    }
109
110
111 1
    public function getSellerId()
112
    {
113 1
        return $this->sellerId;
114
    }
115
116
117 1
    public function getItemId()
118
    {
119 1
        return $this->itemId;
120
    }
121
122
123 1
    public function getBuyerId()
124
    {
125 1
        return $this->buyerId;
126
    }
127
128
129 1
    public function getQuantity()
130
    {
131 1
        return $this->quantity;
132
    }
133
134
135 1
    public function isTypeCreateDeal()
136
    {
137 1
        return $this->eventType === self::EVENT_TYPE_CREATE_DEAL;
138
    }
139
140 1
    public function isTypeCreatePostSaleForm()
141
    {
142 1
        return $this->eventType === self::EVENT_TYPE_CREATE_POST_SALE_FORM;
143
    }
144
145 1
    public function isTypeAbortPostSaleForm()
146
    {
147 1
        return $this->eventType === self::EVENT_TYPE_ABORT_POST_SALE_FORM;
148
    }
149
150 1
    public function isTypeFinishDeal()
151
    {
152 1
        return $this->eventType === self::EVENT_TYPE_FINISH_DEAL;
153
    }
154
155
156
}
157