Completed
Push — master ( db026b...56b106 )
by Oliver
04:09 queued 02:28
created

Callback   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 23
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A update() 0 4 1
1
<?php
2
3
namespace Metabor\Observer;
4
5
use MetaborStd\CallbackInterface;
6
7
/**
8
 * @author Oliver Tischlinger
9
 */
10
class Callback implements \SplObserver
11
{
12
    /**
13
     * @var CallbackInterface
14
     */
15
    private $callback;
16
17
    /**
18
     * @param CallbackInterface $callback
19
     */
20 4
    public function __construct(CallbackInterface $callback)
21
    {
22 4
        $this->callback = $callback;
23 4
    }
24
25
    /**
26
     * @see \SplObserver::update()
27
     */
28 1
    public function update(\SplSubject $subject)
29
    {
30 1
        $this->callback->__invoke($subject);
0 ignored issues
show
Unused Code introduced by
The call to CallbackInterface::__invoke() has too many arguments starting with $subject.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
31 1
    }
32
}
33