1 | <?php |
||
17 | class AdminNotice |
||
18 | { |
||
19 | |||
20 | const ERROR = 'notice-error'; |
||
21 | |||
22 | const WARNING = 'notice-warning'; |
||
23 | |||
24 | const SUCCESS = 'notice-success'; |
||
25 | |||
26 | const INFORMATION = 'notice-info'; |
||
27 | |||
28 | const DISMISSABLE = ' is-dismissible'; |
||
29 | |||
30 | /** |
||
31 | * generic system notice to be converted into a WP admin notice |
||
32 | * |
||
33 | * @var NoticeInterface $notice |
||
34 | */ |
||
35 | private $notice; |
||
36 | |||
37 | |||
38 | /** |
||
39 | * AdminNotice constructor. |
||
40 | * |
||
41 | * @param NoticeInterface $notice |
||
42 | * @param bool $display_now |
||
43 | */ |
||
44 | public function __construct(NoticeInterface $notice, $display_now = true) |
||
53 | |||
54 | |||
55 | /** |
||
56 | * @return void |
||
57 | */ |
||
58 | public function displayNotice() |
||
62 | |||
63 | |||
64 | /** |
||
65 | * produces something like: |
||
66 | * <div class="notice notice-success is-dismissible event-espresso-admin-notice"> |
||
67 | * <p>YOU DID IT!</p> |
||
68 | * <button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this |
||
69 | * notice.</span></button> |
||
70 | * </div> |
||
71 | * |
||
72 | * @return string |
||
73 | */ |
||
74 | public function getNotice() |
||
83 | |||
84 | |||
85 | /** |
||
86 | * @return string |
||
87 | */ |
||
88 | private function getType() |
||
106 | |||
107 | |||
108 | /** |
||
109 | * @return string |
||
110 | */ |
||
111 | protected function getMessage() |
||
119 | |||
120 | |||
121 | /** |
||
122 | * create error code from filepath, function name, |
||
123 | * and line number where notice was generated |
||
124 | * |
||
125 | * @return string |
||
126 | */ |
||
127 | protected function generateErrorCode() |
||
135 | |||
136 | |||
137 | } |
||
138 |
The break statement is not necessary if it is preceded for example by a return statement:
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.