Toastr::notify()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 4
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Yoeunes\Notify\Notifiers;
4
5
class Toastr extends AbstractNotifier implements NotifierInterface
6
{
7
    /**
8
     * Get global toastr options.
9
     *
10
     * @return string
11
     */
12
    public function options(): string
13
    {
14
        return 'toastr.options = '.json_encode($this->config['options']).';';
15
    }
16
17
    /**
18
     * Create a single notification.
19
     *
20
     * @param string      $type
21
     * @param string      $message
22
     * @param string|null $title
23
     * @param string|null $options
24
     *
25
     * @return string
26
     */
27
    public function notify(string $type, string $message = '', string $title = '', string $options = ''): string
28
    {
29
        return "toastr.$type('$message', '$title', $options);";
30
    }
31
}
32