CallbackHandler   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 32
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A send() 0 4 1
1
<?php namespace Understand\UnderstandLaravel5\Handlers;
2
3
class CallbackHandler extends BaseHandler
4
{
5
6
    /**
7
     * Callback
8
     *
9
     * @var callable
10
     */
11
    protected $callback;
12
13
    /**
14
     * Set callback
15
     *
16
     * @param type $callback
17
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
18
     */
19
    public function __construct($callback)
20
    {
21
        $this->callback = $callback;
22
    }
23
24
    /**
25
     * Call user defined callback with request data
26
     *
27
     * @param mixed $requestData
28
     * @return mixed
29
     */
30
    protected function send($requestData)
31
    {
32
        return call_user_func_array($this->callback, [$requestData]);
33
    }
34
}
35