Issues (93)

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/Model/Invoice/LineItem.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
declare(strict_types=1);
4
5
/*
6
 * This software may be modified and distributed under the terms
7
 * of the MIT license. See the LICENSE file for details.
8
 */
9
10
namespace Shapin\Stripe\Model\Invoice;
11
12
use Money\Currency;
13
use Money\Money;
14
use Shapin\Stripe\Model\ContainsMetadata;
15
use Shapin\Stripe\Model\CreatableFromArray;
16
use Shapin\Stripe\Model\LivemodeTrait;
17
use Shapin\Stripe\Model\MetadataCollection;
18
use Shapin\Stripe\Model\MetadataTrait;
19
20
final class LineItem implements CreatableFromArray, ContainsMetadata
21
{
22
    use LivemodeTrait;
23
    use MetadataTrait;
24
25
    const TYPE_INVOICE_ITEM = 'invoiceitem';
26
    const TYPE_SUBSCRIPTION = 'subscription';
27
28
    /**
29
     * @var string
30
     */
31
    private $id;
32
33
    /**
34
     * @var Money
35
     */
36
    private $amount;
37
38
    /**
39
     * @var Currency
40
     */
41
    private $currency;
42
43
    /**
44
     * @var string
45
     */
46
    private $description;
47
48
    /**
49
     * @var bool
50
     */
51
    private $discountable;
52
53
    /**
54
     * @var ?string
55
     */
56
    private $hydraId;
57
58
    /**
59
     * @var ?string
60
     */
61
    private $invoiceItem;
62
63
    /**
64
     * @var Period
65
     */
66
    private $period;
67
68
    /**
69
     * @var ?string
70
     */
71
    private $plan;
72
73
    /**
74
     * @var bool
75
     */
76
    private $proration;
77
78
    /**
79
     * @var int
80
     */
81
    private $quantity;
82
83
    /**
84
     * @var ?string
85
     */
86
    private $subscription;
87
88
    /**
89
     * @var ?string
90
     */
91
    private $subscriptionItem;
92
93
    /**
94
     * @var ?string
95
     */
96
    private $type;
97
98 14
    public static function createFromArray(array $data): self
99
    {
100 14
        $currency = new Currency(strtoupper($data['currency']));
101
102 14
        $model = new self();
103 14
        $model->id = $data['id'];
104 14
        $model->amount = new Money($data['amount'], $currency);
105 14
        $model->currency = $currency;
106 14
        $model->description = $data['description'];
107 14
        $model->discountable = (bool) $data['discountable'];
108 14
        $model->hydraId = $data['hydra_id'] ?? null;
109 14
        $model->invoiceItem = $data['invoice_item'] ?? null;
110 14
        $model->live = $data['livemode'];
111 14
        $model->metadata = MetadataCollection::createFromArray($data['metadata']);
0 ignored issues
show
Documentation Bug introduced by
It seems like \Shapin\Stripe\Model\Met...rray($data['metadata']) of type object<self> is incompatible with the declared type object<Shapin\Stripe\Model\MetadataCollection> of property $metadata.

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...
112 14
        $model->period = Period::createFromArray($data['period']);
0 ignored issues
show
Documentation Bug introduced by
It seems like \Shapin\Stripe\Model\Inv...mArray($data['period']) of type object<self> is incompatible with the declared type object<Shapin\Stripe\Model\Invoice\Period> of property $period.

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...
113 14
        $model->plan = $data['plan'];
114 14
        $model->proration = (bool) $data['proration'];
115 14
        $model->quantity = (int) $data['quantity'];
116 14
        $model->subscription = $data['subscription'];
117 14
        $model->subscriptionItem = $data['subscription_item'] ?? null;
118 14
        $model->type = $data['type'] ?? null;
119
120 14
        return $model;
121
    }
122
123 1
    public function getId(): string
124
    {
125 1
        return $this->id;
126
    }
127
128 1
    public function getAmount(): Money
129
    {
130 1
        return $this->amount;
131
    }
132
133 1
    public function getCurrency(): Currency
134
    {
135 1
        return $this->currency;
136
    }
137
138 1
    public function getDescription()
139
    {
140 1
        return $this->description;
141
    }
142
143 1
    public function isDiscountable(): bool
144
    {
145 1
        return $this->discountable;
146
    }
147
148 1
    public function getHydraId(): ?string
149
    {
150 1
        return $this->hydraId;
151
    }
152
153 1
    public function getInvoiceItem(): ?string
154
    {
155 1
        return $this->invoiceItem;
156
    }
157
158 1
    public function getPeriod(): Period
159
    {
160 1
        return $this->period;
161
    }
162
163 1
    public function getPlan(): ?string
164
    {
165 1
        return $this->plan;
166
    }
167
168 1
    public function isProration(): bool
169
    {
170 1
        return $this->proration;
171
    }
172
173 1
    public function getQuantity(): int
174
    {
175 1
        return $this->quantity;
176
    }
177
178 1
    public function getSubscription(): ?string
179
    {
180 1
        return $this->subscription;
181
    }
182
183 1
    public function getSubscriptionItem(): ?string
184
    {
185 1
        return $this->subscriptionItem;
186
    }
187
188 1
    public function getType(): ?string
189
    {
190 1
        return $this->type;
191
    }
192
}
193