MessageQueue   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 42
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getName() 0 4 1
A createQueue() 0 4 1
1
<?php
2
3
/**
4
 * AppserverIo\Messaging\MessageQueue
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;
22
23
use AppserverIo\Psr\Pms\QueueInterface;
24
25
/**
26
 * Local message queue class implementation.
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 MessageQueue implements QueueInterface
35
{
36
37
    /**
38
     * The queue name to use.
39
     *
40
     * @var string
41
     */
42
    private $name = null;
43
44
    /**
45
     * Initializes the queue with the name to use.
46
     *
47
     * @param string $name Holds the queue name to use
48
     */
49 1
    private function __construct($name)
50
    {
51 1
        $this->name = $name;
52 1
    }
53
54
    /**
55
     * Returns the queue name.
56
     *
57
     * @return string The queue name
58
     */
59 1
    public function getName()
60
    {
61 1
        return $this->name;
62
    }
63
64
    /**
65
     * Initializes and returns a new queue instance.
66
     *
67
     * @param string $name Holds the queue name to use
68
     *
69
     * @return \AppserverIo\Messaging\MessageQueue The instance
70
     */
71 1
    public static function createQueue($name)
72
    {
73 1
        return new MessageQueue($name);
74
    }
75
}
76