ContentClassSelector   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 5
Bugs 4 Features 0
Metric Value
wmc 2
c 5
b 4
f 0
lcom 0
cbo 1
dl 0
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A acceptMessage() 0 4 1
1
<?php
2
3
namespace PEIP\Selector;
4
5
/*
6
 * This file is part of the PEIP package.
7
 * (c) 2009-2016 Timo Michna <timomichna/yahoo.de>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
/**
14
 * ContentClassSelector.
15
 *
16
 * @author Timo Michna <timomichna/yahoo.de>
17
 * @implements \PEIP\INF\Selector\MessageSelector
18
 */
19
class ContentClassSelector implements \PEIP\INF\Selector\MessageSelector
20
{
21
    protected $className;
22
23
    /**
24
     * @param $className
25
     *
26
     * @return
27
     */
28
    public function __construct($className)
29
    {
30
        $this->className = $className;
31
    }
32
33
    /**
34
     * @param $message
35
     *
36
     * @return
37
     */
38
    public function acceptMessage(\PEIP\INF\Message\Message $message)
39
    {
40
        return $message->getContent() instanceof $className;
0 ignored issues
show
Bug introduced by
The variable $className does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
41
    }
42
}
43