Completed
Push — refactor-entity-validators ( 9b4b77...c6627d )
by Stefano
13:07 queued 10:18
created

SluggableTrait::getSlug()   A

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 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * @author Stefano Torresi (http://stefanotorresi.it)
4
 * @license See the file LICENSE.txt for copying permission.
5
 * ************************************************
6
 */
7
8
namespace Thorr\Persistence\Entity;
9
10
trait SluggableTrait
11
{
12
    /**
13
     * @var string
14
     */
15
    protected $slug;
16
17
    /**
18
     * @return string
19
     */
20
    public function getSlug()
21
    {
22
        return $this->slug;
23
    }
24
25
    /**
26
     * Setting to null should regenerate the slug
27
     *
28
     * @param string|null $slug
29
     */
30 1
    public function setSlug($slug)
31
    {
32
        if ($slug !== null) {
33 1
            $slug = (string) $slug;
34
        }
35
36
        $this->slug = $slug;
37
    }
38
}
39