Completed
Branch BUG-10738-inconsistency-in-ses... (860590)
by
unknown
57:39 queued 45:30
created

NoticeConverter   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 79
rs 10
c 0
b 0
f 0
wmc 6
lcom 1
cbo 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getNotices() 0 4 1
A setNotices() 0 4 1
A getThrowExceptions() 0 4 1
A setThrowExceptions() 0 4 1
A clearNotices() 0 4 1
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