Passed
Push — master ( 57971d...267513 )
by Ben
14:57 queued 10s
created

MemoizedUrlRecord::getByModel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 3
c 2
b 1
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Thinktomorrow\Chief\Urls;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class MemoizedUrlRecord extends UrlRecord
8
{
9
    public static function findByModel(Model $model, string $locale = null): UrlRecord
10
    {
11
        return chiefMemoize('url-records-find-by-model', function ($model, $locale = null) {
12
            return parent::findByModel($model, $locale);
13
        }, [$model, $locale]);
14
    }
15
16
    public static function getByModel(Model $model)
17
    {
18
        return chiefMemoize('url-records-get-by-model', function ($model) {
19
            return parent::getByModel($model);
20
        }, [$model]);
21
    }
22
}
23