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

FailureEnumWithArguments   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A VALIDATION_ERROR() 0 7 1
A DB_ERROR() 0 7 1
A message() 0 4 1
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