Passed
Push — fix/radiobuttonstyling ( e57dd3...53f350 )
by Ben
15:46 queued 08:51
created

HomepageSetCheck   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 6
c 0
b 0
f 0
dl 0
loc 18
ccs 5
cts 5
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A check() 0 5 1
A message() 0 3 1
A notifiers() 0 4 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Thinktomorrow\Chief\HealthMonitor\Checks;
6
7
use Thinktomorrow\Chief\Settings\Setting;
8
use Thinktomorrow\Chief\HealthMonitor\Notifiers\AlertBarNotifier;
9
10
class HomepageSetCheck implements HealthCheck
11 32
{
12
    public function check(): bool
13 32
    {
14
        $homepageValue = chiefSetting(Setting::HOMEPAGE);
15 32
16
        return !!$homepageValue;
17
    }
18 32
19
    public function message(): string
20 32
    {
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\Heal...ealthCheck::notifiers() of Thinktomorrow\Chief\Heal...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