1 | <?php |
||
17 | class GenericRequestFactory implements RequestFactory { |
||
18 | |||
19 | /** |
||
20 | * @var URLParser |
||
21 | */ |
||
22 | protected $URLParser; |
||
23 | /** |
||
24 | * @var HeaderParser |
||
25 | */ |
||
26 | private $headerParser; |
||
27 | |||
28 | /** |
||
29 | * BasicRequestFactory constructor. |
||
30 | * @param URLParser $URLParser |
||
31 | * @param HeaderParser $headerParser |
||
32 | */ |
||
33 | 4 | public function __construct(URLParser $URLParser, HeaderParser $headerParser) |
|
38 | |||
39 | /** |
||
40 | * Creates a request from raw $data and a $url |
||
41 | * @param ServerRequestInterface $serverRequest |
||
42 | * @return APIRequest |
||
43 | * @throws UnableToCreateRequestException |
||
44 | * @throws UnableToParseHeadersException |
||
45 | * @throws UnableToParseURLException |
||
46 | */ |
||
47 | 2 | public function create(ServerRequestInterface $serverRequest): APIRequest |
|
72 | |||
73 | /** |
||
74 | * @return URLParser |
||
75 | */ |
||
76 | 2 | public function getURLParser(): URLParser |
|
80 | |||
81 | /** |
||
82 | * @return HeaderParser |
||
83 | */ |
||
84 | 2 | public function getHeaderParser(): HeaderParser |
|
88 | } |
||
89 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.