Completed
Push — master ( 4bf91f...d42076 )
by Nicolas
03:14
created

MessageHookCollection   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A add() 0 4 1
A getIterator() 0 4 1
1
<?php
2
3
namespace Puzzle\AMQP\Collections;
4
5
use Puzzle\AMQP\MessageHook;
6
7
class MessageHookCollection implements \IteratorAggregate
8
{
9
    private
10
        $hooks;
1 ignored issue
show
Coding Style introduced by
The visibility should be declared for property $hooks.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
11
12
    public function __construct(array $hooks = array())
13
    {
14 1
        $this->hooks = array_filter($hooks, function($hook) {
15 1
            return ($hook instanceof MessageHook);
16 1
        });
17 1
    }
18
19 1
    public function add(MessageHook $hook)
20
    {
21 1
        $this->hooks[] = $hook;
22 1
    }
23
24 1
    public function getIterator()
25
    {
26 1
        return new \ArrayIterator($this->hooks);
27
    }
28
}
29