ContentClassSelector::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 3 Features 0
Metric Value
c 4
b 3
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 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