Completed
Push — master ( 1a5000...96ffbe )
by Igor
02:24
created

Alert::alert()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 8
rs 9.4285
cc 2
eloc 5
nc 2
nop 1
1
<?php
2
/**
3
 * @license MIT
4
 * @author Igor Sorokin <[email protected]>
5
 */
6
namespace Dspbee\Bundle\Alert;
7
8
/**
9
 * Save message to the cookie.
10
 *
11
 * Class Alert
12
 * @package Dspbee\Bundle\Alert
13
 */
14
abstract class Alert
15
{
16
    /**
17
     * @param string $message
18
     *
19
     * @return bool
20
     */
21
    public function alert($message)
0 ignored issues
show
Coding Style Best Practice introduced by
Please use __construct() instead of a PHP4-style constructor that is named after the class.
Loading history...
22
    {
23
        if (!headers_sent()) {
24
            setcookie('__alert__', $message . '|' . $this->color, time() + 3600 * 24 * 30, '/');
25
            return true;
26
        }
27
        return false;
28
    }
29
30
    protected $color;
31
}