Completed
Push — master ( 6bc787...c8a008 )
by ARCANEDEV
11s
created

MetaPresenter::getKeywordsLengthAttribute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php namespace Arcanedev\LaravelSeo\Models\Presenters;
2
3
/**
4
 * Class     MetaPresenter
5
 *
6
 * @package  Arcanedev\LaravelSeo\Models\Presenters
7
 * @author   ARCANEDEV <[email protected]>
8
 *
9
 * @property  string                          title
10
 * @property  int                             title_length
11
 * @property  string                          description
12
 * @property  int                             description_length
13
 * @property  \Illuminate\Support\Collection  keywords
14
 * @property  string                          keywords_string
15
 * @property  int                             keywords_length
16
 */
17
trait MetaPresenter
18
{
19
    /* -----------------------------------------------------------------
20
     |  Accessors
21
     | -----------------------------------------------------------------
22
     */
23
    /**
24
     * Get the `title_length` attribute.
25
     *
26
     * @return int
27
     */
28 3
    public function getTitleLengthAttribute()
29
    {
30 3
        return strlen($this->title);
31
    }
32
33
    /**
34
     * Get the `description_length` attribute.
35
     *
36
     * @return int
37
     */
38 3
    public function getDescriptionLengthAttribute()
39
    {
40 3
        return strlen($this->description);
41
    }
42
43
    /**
44
     * Get the `keywords_string` attribute.
45
     *
46
     * @return string
47
     */
48 3
    public function getKeywordsStringAttribute()
49
    {
50 3
        return $this->keywords->implode(', ');
51
    }
52
53
    /**
54
     * Get the `keywords_length` attribute.
55
     *
56
     * @return int
57
     */
58 3
    public function getKeywordsLengthAttribute()
59
    {
60 3
        return strlen($this->keywords_string);
61
    }
62
}
63