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

MessageHookCollection::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 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