Code Duplication    Length = 11-11 lines in 4 locations

src/Notifier.php 4 locations

@@ 237-247 (lines=11) @@
234
     * @param string $title The notification's title
235
     * @param array $options
236
     */
237
    public function info($text, $onlyNextRequest = false, array $options = [])
238
    {
239
        $theme = (isset($options['theme']) && $options['theme'] != '') ? $options['theme'] : 'metroui';
240
        $timeout = (isset($options['timeout']) && $options['timeout'] != '' && is_int($options['timeout'])) ? $options['timeout'] : false;
241
        $layout = (isset($options['layout']) && $options['layout'] != '') ? $options['layout'] : 'topRight';
242
        if ($onlyNextRequest){
243
            $this->addForNextRequest($theme, $timeout, 'info', $layout, $text, null, null);
244
            return;
245
        }
246
        $this->add($theme, $timeout, 'info', $layout, $text, null, null);
247
    }
248
249
    /**
250
     * Shortcut for adding an error notification
@@ 256-266 (lines=11) @@
253
     * @param string $title The notification's title
254
     * @param array $options
255
     */
256
    public function error($text, $onlyNextRequest = false, array $options = [])
257
    {
258
        $theme = (isset($options['theme']) && $options['theme'] != '') ? $options['theme'] : 'metroui';
259
        $timeout = (isset($options['timeout']) && $options['timeout'] != '' && is_int($options['timeout'])) ? $options['timeout'] : 0;
260
        $layout = (isset($options['layout']) && $options['layout'] != '') ? $options['layout'] : 'topRight';
261
        if ($onlyNextRequest){
262
            $this->addForNextRequest($theme, $timeout, 'error', $layout, $text, null, null);
263
            return;
264
        }
265
        $this->add($theme, $timeout, 'error', $layout, $text, null, null, $onlyNextRequest);
266
    }
267
268
    /**
269
     * Shortcut for adding a warning notification
@@ 275-285 (lines=11) @@
272
     * @param string $title The notification's title
273
     * @param array $options
274
     */
275
    public function warning($text, $onlyNextRequest = false, array $options = [])
276
    {
277
        $theme = (isset($options['theme']) && $options['theme'] != '') ? $options['theme'] : 'metroui';
278
        $timeout = (isset($options['timeout']) && $options['timeout'] != '' && is_int($options['timeout'])) ? $options['timeout'] : 0;
279
        $layout = (isset($options['layout']) && $options['layout'] != '') ? $options['layout'] : 'topRight';
280
        if ($onlyNextRequest){
281
            $this->addForNextRequest($theme, $timeout, 'warning', $layout, $text, null, null);
282
            return;
283
        }
284
        $this->add($theme, $timeout, 'warning', $layout, $text, null, null, $onlyNextRequest);
285
    }
286
287
    /**
288
     * Shortcut for adding a success notification
@@ 294-304 (lines=11) @@
291
     * @param string $title The notification's title
292
     * @param array $options
293
     */
294
    public function success($text, $onlyNextRequest = false, array $options = [])
295
    {
296
        $theme = (isset($options['theme']) && $options['theme'] != '') ? $options['theme'] : 'metroui';
297
        $timeout = (isset($options['timeout']) && $options['timeout'] != '' && is_int($options['timeout'])) ? $options['timeout'] : 0;
298
        $layout = (isset($options['layout']) && $options['layout'] != '') ? $options['layout'] : 'topRight';
299
        if ($onlyNextRequest){
300
            $this->addForNextRequest($theme, $timeout, 'success', $layout, $text, null, null);
301
            return;
302
        }
303
        $this->add($theme, $timeout, 'success', $layout, $text, null, null, $onlyNextRequest);
304
    }
305
306
307
    /**