shapintv /
stripe
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
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
|
|||
| 112 | 14 | $model->period = Period::createFromArray($data['period']); |
|
|
0 ignored issues
–
show
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 |
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..