Passed
Push — master ( 0db7f5...3c2912 )
by Ben
74:34 queued 68:06
created

Homepage   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 5
c 1
b 0
f 0
dl 0
loc 11
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A is() 0 9 4
1
<?php
2
3
namespace Thinktomorrow\Chief\Settings;
4
5
use Thinktomorrow\Chief\FlatReferences\ProvidesFlatReference;
6
7
class Homepage
8
{
9
    public static function is($model, string $locale = null): bool
10
    {
11
        $homepageValue = chiefSetting(Setting::HOMEPAGE, $locale);
12
13
        if(!$homepageValue || !is_object($model) || !$model instanceof ProvidesFlatReference) {
14
            return false;
15
        }
16
17
        return $model->flatReference()->is($homepageValue);
18
    }
19
}
20