Completed
Push — master ( 71f3ca...10d1fd )
by Thierry
01:44
created

Alert::warning()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Alert.php - Interface for alert messages.
5
 *
6
 * @package jaxon-dialogs
7
 * @author Thierry Feuzeu <[email protected]>
8
 * @copyright 2016 Thierry Feuzeu <[email protected]>
9
 * @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
10
 * @link https://github.com/jaxon-php/jaxon-core
11
 */
12
13
namespace Jaxon\Dialog;
14
15
class Alert implements Interfaces\Alert
16
{
17
    use Traits\Alert;
18
19
    /**
20
     * Print an alert message.
21
     *
22
     * @param string              $message              The text of the message
23
     * @param string              $title                The title of the message
24
     *
25
     * @return string|void
26
     */
27
    protected function alert($message, $title)
0 ignored issues
show
Unused Code introduced by
The parameter $title is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
28
    {
29
        if($this->getReturn())
30
        {
31
            return 'alert(' . $message . ')';
32
        }
33
    }
34
35
    /**
36
     * Print a success message.
37
     *
38
     * It is a function of the Jaxon\Dialog\Interfaces\Alert interface.
39
     *
40
     * @param string              $message              The text of the message
41
     * @param string|null         $title                The title of the message
42
     *
43
     * @return string|void
44
     */
45
    public function success($message, $title = null)
46
    {
47
        return $this->alert($message, $title);
48
    }
49
50
    /**
51
     * Print an information message.
52
     *
53
     * It is a function of the Jaxon\Dialog\Interfaces\Alert interface.
54
     *
55
     * @param string              $message              The text of the message
56
     * @param string|null         $title                The title of the message
57
     *
58
     * @return string|void
59
     */
60
    public function info($message, $title = null)
61
    {
62
        return $this->alert($message, $title);
63
    }
64
65
    /**
66
     * Print a warning message.
67
     *
68
     * It is a function of the Jaxon\Dialog\Interfaces\Alert interface.
69
     *
70
     * @param string              $message              The text of the message
71
     * @param string|null         $title                The title of the message
72
     *
73
     * @return string|void
74
     */
75
    public function warning($message, $title = null)
76
    {
77
        return $this->alert($message, $title);
78
    }
79
80
    /**
81
     * Print an error message.
82
     *
83
     * It is a function of the Jaxon\Dialog\Interfaces\Alert interface.
84
     *
85
     * @param string              $message              The text of the message
86
     * @param string|null         $title                The title of the message
87
     *
88
     * @return string|void
89
     */
90
    public function error($message, $title = null)
91
    {
92
        return $this->alert($message, $title);
93
    }
94
}
95