Completed
Pull Request — master (#83)
by Sascha-Oliver
02:47
created

FailureEnumWithArguments::message()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace MabeEnumTest\TestAsset;
4
5
use MabeEnum\Enum;
6
7
/**
8
 * @link http://github.com/marc-mabe/php-enum for the canonical source repository
9
 * @copyright Copyright (c) 2015 Marc Bennewitz
10
 * @license http://github.com/marc-mabe/php-enum/blob/master/LICENSE.txt New BSD License
11
 */
12
class FailureEnumWithArguments extends Enum
13
{
14
    const VALIDATION_ERROR = 'validation error';
15
    const DB_ERROR = 'db error';
16
17
    /**
18
     * @var string
19
     */
20
    private $message;
21
22
    /**
23
     * @param $message
24
     * @return FailureEnumWithArguments
25
     */
26
    public static function VALIDATION_ERROR($message)
0 ignored issues
show
Coding Style introduced by
Method name "FailureEnumWithArguments::VALIDATION_ERROR" is not in camel caps format
Loading history...
27
    {
28
        $failure = self::byValue(self::VALIDATION_ERROR);
29
        $failure->message = $message;
30
31
        return $failure;
32
    }
33
34
    /**
35
     * @param string $message
36
     * @return FailureEnumWithArguments
37
     */
38
    public static function DB_ERROR($message)
0 ignored issues
show
Coding Style introduced by
Method name "FailureEnumWithArguments::DB_ERROR" is not in camel caps format
Loading history...
39
    {
40
        $failure = self::byValue(self::DB_ERROR);
41
        $failure->message = $message;
42
43
        return $failure;
44
    }
45
46
    /**
47
     * @return string
48
     */
49
    public function message()
50
    {
51
        return $this->message;
52
    }
53
}
54