QueueProxy   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 42
ccs 0
cts 12
cp 0
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 createFromQueue() 0 4 1
1
<?php
2
3
/**
4
 * AppserverIo\Messaging\QueueProxy
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
 * A proxy implementation for a queue.
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 QueueProxy implements QueueInterface
35
{
36
37
    /**
38
     * The queue name to use.
39
     *
40
     * @var string
41
     */
42
    protected $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
    private function __construct($name)
50
    {
51
        $this->name = $name;
52
    }
53
54
    /**
55
     * Returns the queue name.
56
     *
57
     * @return string The queue name
58
     */
59
    public function getName()
60
    {
61
        return $this->name;
62
    }
63
64
    /**
65
     * Initializes and returns a new proxy instance for the passed queue.
66
     *
67
     * @param \AppserverIo\Psr\Pms\QueueInterface $queue The queue to create the proxy for
68
     *
69
     * @return \AppserverIo\Psr\Pms\QueueInterface The proxy instance
70
     */
71
    public static function createFromQueue(QueueInterface $queue)
72
    {
73
        return new QueueProxy($queue->getName());
74
    }
75
}
76