These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace AerialShip\SamlSPBundle\Bridge; |
||
4 | |||
5 | use AerialShip\LightSaml\Binding\BindingDetector; |
||
6 | use Symfony\Component\HttpFoundation\Request; |
||
7 | |||
8 | class BindingManager extends BindingDetector |
||
9 | { |
||
10 | |||
11 | /** |
||
12 | * @param Request $request |
||
13 | * @return null|string |
||
14 | */ |
||
15 | public function getBindingType(Request $request) |
||
16 | { |
||
17 | $bindingRequest = $this->getBindingRequest($request); |
||
18 | $bindingType = $this->getBinding($bindingRequest); |
||
19 | return $bindingType; |
||
20 | } |
||
21 | |||
22 | /** |
||
23 | * @param Request $request |
||
24 | * @param $bindingType |
||
25 | * @return \AerialShip\LightSaml\Model\Protocol\Message|null |
||
26 | */ |
||
27 | public function receive(Request $request, &$bindingType = null) |
||
28 | { |
||
29 | $result = null; |
||
30 | $bindingRequest = $this->getBindingRequest($request); |
||
31 | $bindingType = $this->getBinding($bindingRequest); |
||
32 | if ($bindingType) { |
||
0 ignored issues
–
show
|
|||
33 | $binding = $this->instantiate($bindingType); |
||
34 | $result = $binding->receive($bindingRequest); |
||
35 | } |
||
36 | return $result; |
||
37 | } |
||
38 | |||
39 | |||
40 | /** |
||
41 | * @param Request $request |
||
42 | * @return \AerialShip\LightSaml\Binding\Request |
||
43 | */ |
||
44 | public function getBindingRequest(Request $request) |
||
45 | { |
||
46 | $result = new \AerialShip\LightSaml\Binding\Request(); |
||
47 | // must be taken unmodified from server since getQueryString() capitalized urlenocoded escape chars, ie. %2f becomes %2F |
||
48 | $result->setQueryString($request->server->get('QUERY_STRING')); |
||
49 | $result->setGet($request->query->all()); |
||
50 | $result->setPost($request->request->all()); |
||
51 | $result->setRequestMethod($request->getMethod()); |
||
52 | return $result; |
||
53 | } |
||
54 | } |
||
55 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: