StateUnknown   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 55
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A get() 0 4 1
A getState() 0 4 1
A __toString() 0 4 1
1
<?php
2
3
/**
4
 * AppserverIo\Messaging\Utils\StateUnknown
5
 *
6
 * NOTICE OF LICENSE
7
 *
8
 * This source file is subject to the Open Software License (OSL 3.0)
9
 * that is available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * PHP version 5
13
 *
14
 * @author    Tim Wagner <[email protected]>
15
 * @copyright 2015 TechDivision GmbH <[email protected]>
16
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
 * @link      https://github.com/appserver-io/messaging
18
 * @link      http://www.appserver.io
19
 */
20
21
namespace AppserverIo\Messaging\Utils;
22
23
use AppserverIo\Psr\Pms\StateKeyInterface;
24
25
/**
26
 * This class holds the state key used for messages with unknown state.
27
 *
28
 * Messages are turned to this state when they are running longer than ten minutes.
29
 *
30
 * @author    Tim Wagner <[email protected]>
31
 * @copyright 2015 TechDivision GmbH <[email protected]>
32
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
33
 * @link      https://github.com/appserver-io/messaging
34
 * @link      http://www.appserver.io
35
 */
36
class StateUnknown implements StateKeyInterface
37
{
38
39
    /**
40
     * Holds the state key for failed messages.
41
     *
42
     * @var integer
43
     */
44
    const KEY = 7;
45
46
    /**
47
     * The string value for the 'unknown' state key.
48
     *
49
     * @var string
50
     */
51
    protected $state = "unknown";
52
53
    /**
54
     * Private constructor for marking the class as utility.
55
     */
56
    final protected function __construct()
57
    {
58
        /* Class is a utility class */
59
    }
60
61
    /**
62
     * Returns a new instance of the state key.
63
     *
64
     * @return \AppserverIo\Messaging\Utils\StateUnknown The instance
65
     */
66
    public static function get()
67
    {
68
        return new StateUnknown();
69
    }
70
71
    /**
72
     * Returns the key value of the state key instance.
73
     *
74
     * @return integer The key value
75
     */
76
    public function getState()
77
    {
78
        return StateUnknown::KEY;
79
    }
80
81
    /**
82
     * Returns the string value for the state key.
83
     *
84
     * @return string The string value
85
     */
86
    public function __toString()
87
    {
88
        return $this->state;
89
    }
90
}
91