StateActive::__toString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
/**
4
 * AppserverIo\Messaging\Utils\StateActive
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 the active state.
27
 *
28
 * @author    Tim Wagner <[email protected]>
29
 * @copyright 2015 TechDivision GmbH <[email protected]>
30
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
31
 * @link      https://github.com/appserver-io/messaging
32
 * @link      http://www.appserver.io
33
 */
34
class StateActive implements StateKeyInterface
35
{
36
37
    /**
38
     * Holds the key for messages with an active state.
39
     *
40
     * @var integer
41
     */
42
    const KEY = 1;
43
44
    /**
45
     * The string value for the 'active' state key.
46
     *
47
     * @var string
48
     */
49
    protected $state = "active";
50
51
    /**
52
     * Protected constructor for marking the class as utility.
53
     */
54
    final protected function __construct()
55
    {
56
        /* Class is a utility class */
57
    }
58
59
    /**
60
     * Returns a new instance of the state key.
61
     *
62
     * @return \AppserverIo\Messaging\Utils\StateActive The instance
63
     */
64
    public static function get()
65
    {
66
        return new StateActive();
67
    }
68
69
    /**
70
     * Returns the key value of the state key instance.
71
     *
72
     * @return integer The key value
73
     */
74
    public function getState()
75
    {
76
        return StateActive::KEY;
77
    }
78
79
    /**
80
     * Returns the string value for the active state key.
81
     *
82
     * @return string The string value
83
     */
84
    public function __toString()
85
    {
86
        return $this->state;
87
    }
88
}
89