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

Alert   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 1
cbo 0
dl 0
loc 18
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A alert() 0 8 2
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
}