SlumberReferenced::getReference()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * File was created 05.10.2015 17:18
4
 */
5
6
namespace PeekAndPoke\Component\Slumber\Data\Addon\PublicReference;
7
8
use PeekAndPoke\Component\Slumber\Annotation\Slumber;
9
10
/**
11
 * Use this to auto fill the public reference of a persisted object when it is saved.
12
 *
13
 * This is handy if one does NOT want to expose internal database ids or similar.
14
 *
15
 * The implementation depends on a service being present.
16
 *
17
 * @see    SlumberDependencies
18
 * @see    PublicReferenceGenerator
19
 *
20
 * @author Karsten J. Gerber <[email protected]>
21
 */
22
trait SlumberReferenced
23
{
24
    /**
25
     * @var string
26
     *
27
     * @see PublicReferenceGenerator
28
     *
29
     * @Slumber\AsString()
30
     *
31
     * @Slumber\Store\AsPublicReference(
32
     *      service = \PeekAndPoke\Component\Slumber\Data\Addon\PublicReference\PublicReferenceGenerator::SERVICE_ID,
33
     *      ofClass = \PeekAndPoke\Component\Slumber\Data\Addon\PublicReference\PublicReferenceGenerator::class,
34
     * )
35
     *
36
     * @Slumber\Store\Indexed(
37
     *     unique     = false,
38
     *     background = true,
39
     *     direction  = "ASC",
40
     *     sparse     = false,
41
     * )
42
     */
43
    protected $reference;
44
45
    /**
46
     * @return string
47
     */
48 1
    public function getReference()
49
    {
50 1
        return $this->reference;
51
    }
52
53
    /**
54
     * @param string $reference
55
     *
56
     * @return $this
57
     */
58
    public function setReference($reference)
59
    {
60
        $this->reference = $reference;
61
62
        return $this;
63
    }
64
}
65