Completed
Branch BUG/11155/fix-payment-capabili... (cfe1f5)
by
unknown
26:24 queued 13:40
created

Context::setSlug()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 4
loc 4
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace EventEspresso\core\domain\entities\contexts;
4
5
defined('EVENT_ESPRESSO_VERSION') || exit;
6
7
8
9
/**
10
 * Class Context
11
 * Simple DTO for conveying the background details about why some other logic is being performed,
12
 * that can assist with the decision making process or simply enhance logging.
13
 *
14
 * @package EventEspresso\core\domain\entities
15
 * @author  Brent Christensen
16
 * @since   4.9.46.rc.076
17
 */
18 View Code Duplication
class Context implements ContextInterface
19
{
20
21
    /**
22
     * @var string $slug
23
     */
24
    private $slug;
25
26
    /**
27
     * @var string $description
28
     */
29
    private $description;
30
31
32
    /**
33
     * Context constructor.
34
     *
35
     * @param string $slug
36
     * @param string $description
37
     */
38
    public function __construct($slug, $description)
39
    {
40
        $this->setSlug($slug);
41
        $this->setDescription($description);
42
    }
43
44
45
    /**
46
     * @return string
47
     */
48
    public function slug()
49
    {
50
        return $this->slug;
51
    }
52
53
54
    /**
55
     * @param string $slug
56
     */
57
    private function setSlug($slug)
58
    {
59
        $this->slug = sanitize_key($slug);
60
    }
61
62
63
    /**
64
     * @return string
65
     */
66
    public function description()
67
    {
68
        return $this->description;
69
    }
70
71
72
    /**
73
     * @param string $description
74
     */
75
    private function setDescription($description)
76
    {
77
        $this->description = sanitize_text_field($description);
78
    }
79
80
}
81
// Location: Context.php
82