BaseConsumer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 1 Features 1
Metric Value
wmc 2
c 3
b 1
f 1
lcom 1
cbo 1
dl 0
loc 19
ccs 5
cts 5
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A setCallback() 0 7 2
1
<?php
2
/**
3
 * The MIT License
4
 *
5
 * Copyright (c) 2010 Alvaro Videla
6
 *
7
 * Permission is hereby granted, free of charge, to any person obtaining a copy
8
 * of this software and associated documentation files (the "Software"), to deal
9
 * in the Software without restriction, including without limitation the rights
10
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
 * copies of the Software, and to permit persons to whom the Software is
12
 * furnished to do so, subject to the following conditions:
13
 *
14
 * The above copyright notice and this permission notice shall be included in
15
 * all copies or substantial portions of the Software.
16
 *
17
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
 * SOFTWARE.
24
 *
25
 * PHP version 5.3
26
 *
27
 * @category   Thumper
28
 * @package    Thumper
29
 * @author     Alvaro Videla
30
 * @copyright  2010 Alvaro Videla. All rights reserved.
31
 * @license    MIT http://opensource.org/licenses/MIT
32
 * @link       https://github.com/videlalvaro/Thumper
33
 */
34
namespace Thumper;
35
36
abstract class BaseConsumer extends BaseAmqp
37
{
38
    /**
39
     * @var callable
40
     */
41
    protected $callback;
42
43
    /**
44
     * @param callable $callback
45
     * @throws \Exception
46
     */
47 30
    public function setCallback($callback)
48
    {
49 30
        if (is_callable($callback) === false) {
50 5
            throw new \Exception("Callback $callback is not callable.");
51
        }
52 25
        $this->callback = $callback;
53 25
    }
54
}
55