Passed
Push — master ( 8a5699...ed06a2 )
by Vasyl
02:38 queued 24s
created

UrlAliasable   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 8
c 2
b 0
f 0
dl 0
loc 32
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A urlAlias() 0 5 1
A urlAliases() 0 5 1
A getLocaleboundStr() 0 7 2
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: fomvasss
5
 * Date: 21.08.18
6
 * Time: 11:34
7
 */
8
9
namespace Fomvasss\UrlAliases\Traits;
10
11
trait UrlAliasable
12
{
13
    /**
14
     * @return mixed
15
     */
16
    public function urlAlias()
17
    {
18
        $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

18
        $model = /** @scrutinizer ignore-call */ config('url-aliases.model', \Fomvasss\UrlAliases\Models\UrlAlias::class);
Loading history...
19
20
        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

20
        return $this->/** @scrutinizer ignore-call */ morphOne($model, 'model');
Loading history...
21
    }
22
23
    /**
24
     * @return mixed
25
     */
26
    public function urlAliases()
27
    {
28
        $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

28
        $model = /** @scrutinizer ignore-call */ config('url-aliases.model', \Fomvasss\UrlAliases\Models\UrlAlias::class);
Loading history...
29
30
        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

30
        return $this->/** @scrutinizer ignore-call */ morphMany($model, 'model');
Loading history...
31
    }
32
33
    /**
34
     * @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...
35
     */
36
    public function getLocaleboundStr()
37
    {
38
        if ($this->urlAlias) {
39
            return $this->urlAlias->locale_bound;
40
        } 
41
        
42
        return null;
43
    }
44
}