Completed
Branch BUG-10636-remove-unnecessary-b... (dfa227)
by
unknown
35:02 queued 23:26
created

NoticeConverter::setNotices()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace EventEspresso\core\services\notices;
4
5
defined('EVENT_ESPRESSO_VERSION') || exit;
6
7
8
9
/**
10
 * Class NoticeConverter
11
 * Converts notifications in a NoticesContainerInterface container into another format such as EE_Error notifications
12
 *
13
 * @package       Event Espresso
14
 * @author        Brent Christensen
15
 * @since         $VID:$
16
 */
17
abstract class NoticeConverter implements NoticeConverterInterface
18
{
19
20
    /**
21
     * @var NoticesContainerInterface $notices
22
     */
23
    private $notices;
24
25
    /**
26
     * if set to true, then errors will be thrown as exceptions
27
     *
28
     * @var boolean $throw_exceptions
29
     */
30
    private $throw_exceptions;
31
32
33
34
    /**
35
     * NoticeConverter constructor.
36
     *
37
     * @param bool                      $throw_exceptions
38
     */
39
    public function __construct($throw_exceptions = false)
40
    {
41
        $this->throw_exceptions = $throw_exceptions;
42
    }
43
44
45
46
    /**
47
     * @return NoticesContainerInterface
48
     */
49
    public function getNotices()
50
    {
51
        return $this->notices;
52
    }
53
54
55
56
    /**
57
     * @param NoticesContainerInterface $notices
58
     */
59
    protected function setNotices(NoticesContainerInterface $notices)
60
    {
61
        $this->notices = $notices;
62
    }
63
64
65
66
    /**
67
     * @return bool
68
     */
69
    public function getThrowExceptions()
70
    {
71
        return $this->throw_exceptions;
72
    }
73
74
75
76
    /**
77
     * @param bool $throw_exceptions
78
     */
79
    public function setThrowExceptions($throw_exceptions)
80
    {
81
        $this->throw_exceptions = filter_var($throw_exceptions, FILTER_VALIDATE_BOOLEAN);
82
    }
83
84
85
86
    /**
87
     * @return void;
88
     */
89
    public function clearNotices()
90
    {
91
        $this->notices = null;
92
    }
93
94
95
}
96