UrlAliasable   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
eloc 9
c 4
b 0
f 0
dl 0
loc 34
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A urlAlias() 0 5 1
A getLocaleboundStr() 0 7 2
A urlAliases() 0 5 1
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
}