Completed
Push — master ( fff73d...f066e6 )
by Thierry
01:44
created

src/Dialog/Alert.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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