summaryrefslogtreecommitdiffstats
path: root/common/app/classes/PlanetError.php
blob: 31923a3ad535920840f37aa4e309aca574881c25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php

class PlanetError
{
    public $level;
    public $message;

    public function __construct($level, $message)
    {
        $this->level = (int) $level;
        $this->message = $message;
    }

    public function toString($format = '%1$s : %2$s')
    {
        $levels = array(
            1 => 'notice',
            2 => 'warning',
            3 => 'error',
        );
        return sprintf($format, $levels[$this->level], $this->message);
    }
}