Completed
Push — master ( dd0453...7030c1 )
by Edgar
02:30
created

GatewayManager::runHandler()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Inbounder;
4
5
use Illuminate\Http\Request;
6
use Inbounder\AbstractHandler;
7
8
class GatewayManager
9
{
10
    /**
11
     * @var Request
12
     */
13
    protected $request;
14
15
    /**
16
     * @var ParserInterface
17
     */
18
    protected $parser;
19
20
    /**
21
     * @var HandlerInterface
22
     */
23
    protected $handler;
24
25
    /**
26
     * 
27
     */
28
    public function __construct(AbstractHandler $handler, Request $request)
1 ignored issue
show
Bug introduced by
You have injected the Request via parameter $request. This is generally not recommended as there might be multiple instances during a request cycle (f.e. when using sub-requests). Instead, it is recommended to inject the RequestStack and retrieve the current request each time you need it via getCurrentRequest().
Loading history...
29
    {
30
        $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...
31
        $this->request = $request;
32
        
33
        $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...
34
        $this->parser->request($request);
0 ignored issues
show
Bug introduced by
The method request() does not seem to exist on object<Inbounder\Parsers...tracts\ParserInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
35
    }
36
37
    /**
38
     * Parse the inbound request
39
     * 
40
     * @return ParserInterface
41
     */
42
    public function parse()
43
    {
44
        return $this->parser->parse();
45
    }
46
47
    /**
48
     * Run the handler
49
     * 
50
     * @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...
51
     */
52
    public function runHandler()
53
    {
54
        return $this->handler->run($this->parse());
55
    }
56
}
57