FooterPresenter::getLocaleNameAttribute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 0
cts 4
cp 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php namespace Arcanesoft\Seo\Models\Presenters;
2
3
use Arcanesoft\Seo\Entities\Locales;
4
5
/**
6
 * Class     FooterPresenter
7
 *
8
 * @package  Arcanesoft\Seo\Models\Presenters
9
 * @author   ARCANEDEV <[email protected]>
10
 *
11
 * @property  string  locale
12
 * @property  string  locale_name
13
 * @property  string  content
14
 *
15
 * @property  \Arcanesoft\Seo\Models\Page  page
16
 */
17
trait FooterPresenter
18
{
19
    /* -----------------------------------------------------------------
20
     |  Accessors
21
     | -----------------------------------------------------------------
22
     */
23
24
    /**
25
     * Get the `locale_name` attribute.
26
     *
27
     * @return string|null
28
     */
29
    public function getLocaleNameAttribute()
30
    {
31
        return Locales::get($this->locale);
32
    }
33
34
    /**
35
     * Get the `content` attribute.
36
     *
37
     * @return string
38
     */
39
    public function getContentAttribute()
40
    {
41
        return $this->page->renderContent([
42
            'footer_name'         => $this->name,
0 ignored issues
show
Bug introduced by
The property name does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
43
            'footer_localization' => $this->localization,
0 ignored issues
show
Bug introduced by
The property localization does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
44
        ]);
45
    }
46
}
47