Passed
Push — 0.5 ( 992a0c...ce220b )
by Ben
07:09
created

HomepageSetCheck::notifiers()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Thinktomorrow\Chief\System\HealthMonitor\Checks;
6
7
use Thinktomorrow\Chief\Settings\Setting;
8
use Thinktomorrow\Chief\System\HealthMonitor\Notifiers\AlertBarNotifier;
9
10
class HomepageSetCheck implements HealthCheck
11
{
12
    public function check(): bool
13
    {
14
        $homepageValue = chiefSetting(Setting::HOMEPAGE);
15
16
        return !!$homepageValue;
17
    }
18
19
    public function message(): string
20
    {
21
        return 'Het lijkt erop dat er geen homepagina ingesteld is. Stel er een in hier: <a href="' . route('chief.back.settings.edit') . '" class="text-secondary-800 underline hover:text-white">Settings</a>';
22
    }
23
24
    public function notifiers(): array
25
    {
26
        return [
0 ignored issues
show
Bug Best Practice introduced by
The expression return array(Thinktomorr...lertBarNotifier::class) returns the type array<integer,string> which is incompatible with the return type mandated by Thinktomorrow\Chief\Syst...ealthCheck::notifiers() of Thinktomorrow\Chief\Syst...or\Notifiers\Notifier[].

In the issue above, the returned value is violating the contract defined by the mentioned interface.

Let's take a look at an example:

interface HasName {
    /** @return string */
    public function getName();
}

class Name {
    public $name;
}

class User implements HasName {
    /** @return string|Name */
    public function getName() {
        return new Name('foo'); // This is a violation of the ``HasName`` interface
                                // which only allows a string value to be returned.
    }
}
Loading history...
27
            AlertBarNotifier::class,
28
        ];
29
    }
30
}
31