Passed
Push — main ( 02d0e2...a48ca0 )
by Thierry
12:44 queued 11:20
created

SweetAlert   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 37
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getUri() 0 3 1
A getReadyScript() 0 3 1
A getName() 0 3 1
A getJs() 0 3 1
1
<?php
2
3
/**
4
 * SweetAlertLibrary.php
5
 *
6
 * Adapter for the SweetAlert library.
7
 *
8
 * @package jaxon-dialogs
9
 * @author Thierry Feuzeu <[email protected]>
10
 * @copyright 2016 Thierry Feuzeu <[email protected]>
11
 * @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
12
 * @link https://github.com/jaxon-php/jaxon-dialogs
13
 */
14
15
namespace Jaxon\Dialogs\Dialog\Library;
16
17
use Jaxon\Dialogs\Dialog\AbstractLibrary;
18
use Jaxon\App\Dialog\Library\AlertInterface;
19
use Jaxon\App\Dialog\Library\ConfirmInterface;
20
21
class SweetAlert extends AbstractLibrary implements AlertInterface, ConfirmInterface
22
{
23
    /**
24
     * @const The library name
25
     */
26
    const NAME = 'sweetalert';
27
28
    /**
29
     * @inheritDoc
30
     */
31
    public function getName(): string
32
    {
33
        return self::NAME;
34
    }
35
36
    /**
37
     * @inheritDoc
38
     */
39
    public function getUri(): string
40
    {
41
        return 'https://cdn.jsdelivr.net/npm/[email protected]/dist';
42
    }
43
44
    /**
45
     * @inheritDoc
46
     */
47
    public function getJs(): string
48
    {
49
        return $this->helper()->getJsCode('sweetalert.min.js');
50
    }
51
52
    /**
53
     * @inheritDoc
54
     */
55
    public function getReadyScript(): string
56
    {
57
        return $this->helper()->render('sweetalert.js');
58
    }
59
}
60