GatewayManager   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 47
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A parse() 0 4 1
A runHandler() 0 4 1
1
<?php
2
3
namespace Inbounder;
4
5
use Illuminate\Http\Request;
6
7
class GatewayManager
8
{
9
    /**
10
     * @var Request
11
     */
12
    protected $request;
13
14
    /**
15
     * @var ParserInterface
16
     */
17
    protected $parser;
18
19
    /**
20
     * @var HandlerInterface
21
     */
22
    protected $handler;
23
24
25
    public function __construct(AbstractHandler $handler, Request $request)
26
    {
27
        $this->handler = $handler;
0 ignored issues
show
Documentation Bug introduced by
It seems like $handler of type object<Inbounder\AbstractHandler> is incompatible with the declared type object<Inbounder\HandlerInterface> of property $handler.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
28
        $this->request = $request;
29
30
        $this->parser = $handler->parser();
0 ignored issues
show
Documentation Bug introduced by
It seems like $handler->parser() of type object<Inbounder\Parsers...tracts\ParserInterface> is incompatible with the declared type object<Inbounder\ParserInterface> of property $parser.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
31
        $this->parser->request($request);
32
    }
33
34
    /**
35
     * Parse the inbound request.
36
     *
37
     * @return ParserInterface
38
     */
39
    public function parse()
40
    {
41
        return $this->parser->parse();
42
    }
43
44
    /**
45
     * Run the handler.
46
     *
47
     * @return ??
0 ignored issues
show
Documentation introduced by
The doc-type ?? could not be parsed: Unknown type name "??" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
48
     */
49
    public function runHandler()
50
    {
51
        return $this->handler->run($this->parse());
52
    }
53
}
54