1 | <?php |
||
34 | abstract class AbstractBootstrapController extends Controller { |
||
35 | |||
36 | /** |
||
37 | * Get the event dispatcher. |
||
38 | * |
||
39 | * @return EventDispatcherInterface Returns the event dispatcher. |
||
40 | */ |
||
41 | protected function getEventDispatcher() { |
||
44 | |||
45 | /** |
||
46 | * Get the kernel event listener. |
||
47 | * |
||
48 | * @return KernelEventListener Returns the kernel event listener. |
||
49 | */ |
||
50 | protected function getKernelEventListener() { |
||
53 | |||
54 | /** |
||
55 | * Get the logger. |
||
56 | * |
||
57 | * @return LoggerInterface Returns the logger. |
||
58 | */ |
||
59 | protected function getLogger() { |
||
62 | |||
63 | /** |
||
64 | * Get the router. |
||
65 | * |
||
66 | * @return RouterInterface Returns the router. |
||
67 | */ |
||
68 | protected function getRouter() { |
||
71 | |||
72 | /** |
||
73 | * Get the translator. |
||
74 | * |
||
75 | * @return TranslatorInterface Returns the translator. |
||
76 | */ |
||
77 | protected function getTranslator() { |
||
80 | |||
81 | /** |
||
82 | * Determines if the connected user have roles or redirect. |
||
83 | * |
||
84 | * @param array $roles The roles. |
||
85 | * @param boolean $or OR ? |
||
86 | * @param string $redirect The redirect. |
||
87 | * @return boolean Returns true. |
||
88 | * @throws BadUserRoleException Throws a bad user role exception. |
||
89 | */ |
||
90 | protected function hasRolesOrRedirect(array $roles, $or, $redirect) { |
||
106 | |||
107 | /** |
||
108 | * Notify. |
||
109 | * |
||
110 | * @param string $eventName The event name. |
||
111 | * @param string $notification The notification. |
||
112 | * @param string $type The notification type. |
||
113 | * @return Event Returns the event. |
||
114 | */ |
||
115 | private function notify($eventName, $notification, $type) { |
||
129 | |||
130 | /** |
||
131 | * Notify "Danger". |
||
132 | * |
||
133 | * @param string $notification The notification. |
||
134 | * @return Event Returns the event. |
||
135 | */ |
||
136 | protected function notifyDanger($notification) { |
||
139 | |||
140 | /** |
||
141 | * Notify "Info". |
||
142 | * |
||
143 | * @param string $notification The notification. |
||
144 | * @return Event Returns the event. |
||
145 | */ |
||
146 | protected function notifyInfo($notification) { |
||
149 | |||
150 | /** |
||
151 | * Notify "Success". |
||
152 | * |
||
153 | * @param string $notification The notification. |
||
154 | * @return Event Returns the event. |
||
155 | */ |
||
156 | protected function notifySuccess($notification) { |
||
159 | |||
160 | /** |
||
161 | * Notify "Warning". |
||
162 | * |
||
163 | * @param string $notification The notification. |
||
164 | * @return Event Returns the event. |
||
165 | */ |
||
166 | protected function notifyWarning($notification) { |
||
169 | |||
170 | } |
||
171 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: