UrlAliasable::getLocaleboundStr()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
c 0
b 0
f 0
nc 2
nop 0
dl 0
loc 7
rs 10
1
<?php
2
3
namespace Fomvasss\UrlAliases\Traits;
4
5
trait UrlAliasable
6
{
7
    use LocaleScopes;
8
9
    /**
10
     * @return mixed
11
     */
12
    public function urlAlias()
13
    {
14
        $model = config('url-aliases.model', \Fomvasss\UrlAliases\Models\UrlAlias::class);
0 ignored issues
show
Bug introduced by
The function config was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

14
        $model = /** @scrutinizer ignore-call */ config('url-aliases.model', \Fomvasss\UrlAliases\Models\UrlAlias::class);
Loading history...
15
16
        return $this->morphOne($model, 'model');
0 ignored issues
show
Bug introduced by
It seems like morphOne() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

16
        return $this->/** @scrutinizer ignore-call */ morphOne($model, 'model');
Loading history...
17
    }
18
19
    /**
20
     * @return mixed
21
     */
22
    public function urlAliases()
23
    {
24
        $model = config('url-aliases.model', \Fomvasss\UrlAliases\Models\UrlAlias::class);
0 ignored issues
show
Bug introduced by
The function config was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
        $model = /** @scrutinizer ignore-call */ config('url-aliases.model', \Fomvasss\UrlAliases\Models\UrlAlias::class);
Loading history...
25
26
        return $this->morphMany($model, 'model');
0 ignored issues
show
Bug introduced by
It seems like morphMany() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

26
        return $this->/** @scrutinizer ignore-call */ morphMany($model, 'model');
Loading history...
27
    }
28
29
    /**
30
     * @return |null
0 ignored issues
show
Documentation Bug introduced by
The doc comment |null at position 0 could not be parsed: Unknown type name '|' at position 0 in |null.
Loading history...
31
     */
32
    public function getLocaleboundStr()
33
    {
34
        if ($this->urlAlias) {
35
            return $this->urlAlias->locale_bound;
36
        } 
37
        
38
        return null;
39
    }
40
}