Passed
Push — master ( bb924a...090072 )
by Vasyl
01:56
created

UrlAliasable::urlAlias()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
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
     * Get url-alias.
35
     *
36
     * @return \Illuminate\Contracts\Routing\UrlGenerator|string
37
     */
38
    public function urlA()
39
    {
40
        return url(optional($this->urlAlias)->alias ?? config('url-aliases.url_a_is_empty', '/'));
0 ignored issues
show
Bug introduced by
The function url 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

40
        return /** @scrutinizer ignore-call */ url(optional($this->urlAlias)->alias ?? config('url-aliases.url_a_is_empty', '/'));
Loading history...
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

40
        return url(optional($this->urlAlias)->alias ?? /** @scrutinizer ignore-call */ config('url-aliases.url_a_is_empty', '/'));
Loading history...
41
    }
42
43
    /**
44
     * Get locale url-alias.
45
     *
46
     * @return \Illuminate\Contracts\Routing\UrlGenerator|string
47
     */
48
    public function urlLA()
49
    {
50
        return url(optional($this->urlAlias)->localeAlias ?? config('url-aliases.url_a_is_empty', '/'));
0 ignored issues
show
Bug introduced by
The function url 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

50
        return /** @scrutinizer ignore-call */ url(optional($this->urlAlias)->localeAlias ?? config('url-aliases.url_a_is_empty', '/'));
Loading history...
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

50
        return url(optional($this->urlAlias)->localeAlias ?? /** @scrutinizer ignore-call */ config('url-aliases.url_a_is_empty', '/'));
Loading history...
51
    }
52
}