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\ServerMonitor\Notifications; |
||
4 | |||
5 | use Spatie\ServerMonitor\Models\Check; |
||
6 | use Illuminate\Notifications\Notification; |
||
7 | |||
8 | abstract class BaseNotification extends Notification |
||
9 | { |
||
10 | /** |
||
11 | * Get the notification's delivery channels. |
||
12 | * |
||
13 | * @param mixed $notifiable |
||
14 | * @return array |
||
15 | */ |
||
16 | public function via($notifiable) |
||
17 | { |
||
18 | return config('server-monitor.notifications.notifications.'.static::class); |
||
19 | } |
||
20 | |||
21 | public function getCheck(): Check |
||
22 | { |
||
23 | return $this->event->check; |
||
24 | } |
||
25 | |||
26 | protected function getMessageText(): ?string |
||
27 | { |
||
28 | return ucfirst($this->getCheck()->last_run_message); |
||
0 ignored issues
–
show
|
|||
29 | } |
||
30 | |||
31 | protected function getSubject(): string |
||
32 | { |
||
33 | return "{$this->getCheck()->type} on {$this->getCheck()->host->name}"; |
||
0 ignored issues
–
show
The property
type does not exist on object<Spatie\ServerMonitor\Models\Check> . 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...
The property
host does not exist on object<Spatie\ServerMonitor\Models\Check> . 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...
|
|||
34 | } |
||
35 | |||
36 | abstract public function shouldSend(): bool; |
||
37 | } |
||
38 |
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.