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

Homepage::is()   A

Complexity

Conditions 4
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 9
rs 10
cc 4
nc 2
nop 2
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