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 Spatie\StripeWebhooks\Exceptions; |
||
4 | |||
5 | use Exception; |
||
6 | use Spatie\StripeWebhooks\StripeWebhookCall; |
||
7 | |||
8 | class WebhookFailed extends Exception |
||
9 | { |
||
10 | public static function missingSignature() |
||
11 | { |
||
12 | return new static('The request did not contain a header named `Stripe-Signature`.'); |
||
13 | } |
||
14 | |||
15 | public static function invalidSignature($signature) |
||
16 | { |
||
17 | return new static("The signature `{$signature}` found in the header named `Stripe-Signature` is invalid. Make sure that the `services.stripe.webhook_signing_secret` config key is set to the value you found on the Stripe dashboard. If you are caching your config try running `php artisan cache:clear` to resolve the problem."); |
||
18 | } |
||
19 | |||
20 | public static function signingSecretNotSet() |
||
21 | { |
||
22 | return new static('The Stripe webhook signing secret is not set. Make sure that the `services.stripe.webhook_signing_secret` config key is set to the value you found on the Stripe dashboard.'); |
||
23 | } |
||
24 | |||
25 | public static function jobClassDoesNotExist(string $jobClass, StripeWebhookCall $webhookCall) |
||
26 | { |
||
27 | return new static("Could not process webhook id `{$webhookCall->id}` of type `{$webhookCall->type} because the configured jobclass `$jobClass` does not exist."); |
||
0 ignored issues
–
show
The property
type does not exist on object<Spatie\StripeWebhooks\StripeWebhookCall> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property.
Loading history...
|
|||
28 | } |
||
29 | |||
30 | public static function missingType(StripeWebhookCall $webhookCall) |
||
31 | { |
||
32 | return new static("Webhook call id `{$webhookCall->id}` did not contain a type. Valid Stripe webhook calls should always contain a type."); |
||
33 | } |
||
34 | |||
35 | public function render($request) |
||
36 | { |
||
37 | return response(['error' => $this->getMessage()], 400); |
||
38 | } |
||
39 | } |
||
40 |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.