MetaPresenter::getDescriptionLengthAttribute()   A
last analyzed

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
    /**
25
     * Get the `title_length` attribute.
26
     *
27
     * @return int
28
     */
29 2
    public function getTitleLengthAttribute()
30
    {
31 2
        return strlen($this->title);
32
    }
33
34
    /**
35
     * Get the `description_length` attribute.
36
     *
37
     * @return int
38
     */
39 2
    public function getDescriptionLengthAttribute()
40
    {
41 2
        return strlen($this->description);
42
    }
43
44
    /**
45
     * Get the `keywords_string` attribute.
46
     *
47
     * @return string
48
     */
49 2
    public function getKeywordsStringAttribute()
50
    {
51 2
        return $this->keywords->implode(', ');
52
    }
53
54
    /**
55
     * Get the `keywords_length` attribute.
56
     *
57
     * @return int
58
     */
59 2
    public function getKeywordsLengthAttribute()
60
    {
61 2
        return strlen($this->keywords_string);
62
    }
63
}
64