1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the LightSAML-Core package. |
5
|
|
|
* |
6
|
|
|
* (c) Milos Tomic <[email protected]> |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the MIT license that is bundled |
9
|
|
|
* with this source code in the file LICENSE. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace LightSaml\Binding; |
13
|
|
|
|
14
|
|
|
use LightSaml\Context\Profile\MessageContext; |
15
|
|
|
use LightSaml\Event\BindingMessageReceived; |
16
|
|
|
use LightSaml\Event\BindingMessageSent; |
17
|
|
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
18
|
|
|
use Symfony\Component\HttpFoundation\Request; |
19
|
|
|
|
20
|
|
|
abstract class AbstractBinding |
21
|
|
|
{ |
22
|
|
|
/** @var EventDispatcherInterface|null */ |
23
|
|
|
protected $eventDispatcher; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @param EventDispatcherInterface|null $eventDispatcher |
27
|
|
|
* |
28
|
|
|
* @return AbstractBinding |
29
|
|
|
*/ |
30
|
11 |
|
public function setEventDispatcher(EventDispatcherInterface $eventDispatcher = null) |
31
|
|
|
{ |
32
|
11 |
|
$this->eventDispatcher = $eventDispatcher; |
33
|
|
|
|
34
|
11 |
|
return $this; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @return null|\Symfony\Component\EventDispatcher\EventDispatcherInterface |
39
|
|
|
*/ |
40
|
4 |
|
public function getEventDispatcher() |
41
|
|
|
{ |
42
|
4 |
|
return $this->eventDispatcher; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @param string $messageString |
47
|
|
|
*/ |
48
|
3 |
|
protected function dispatchReceive($messageString) |
49
|
|
|
{ |
50
|
3 |
|
if ($this->eventDispatcher) { |
51
|
3 |
|
$event = new BindingMessageReceived($messageString); |
52
|
3 |
|
$this->eventDispatcher->dispatch($event, $event::NAME); |
|
|
|
|
53
|
|
|
} |
54
|
3 |
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @param string $messageString |
58
|
|
|
*/ |
59
|
6 |
|
protected function dispatchSend($messageString) |
60
|
|
|
{ |
61
|
6 |
|
if ($this->eventDispatcher) { |
62
|
3 |
|
$event = new BindingMessageSent($messageString); |
63
|
3 |
|
$this->eventDispatcher->dispatch($event, $event::NAME); |
|
|
|
|
64
|
|
|
} |
65
|
6 |
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @param MessageContext $context |
69
|
|
|
* @param null|string $destination |
70
|
|
|
* |
71
|
|
|
* @return \Symfony\Component\HttpFoundation\Response |
72
|
|
|
*/ |
73
|
|
|
abstract public function send(MessageContext $context, $destination = null); |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @param Request $request |
77
|
|
|
* @param MessageContext $context |
78
|
|
|
*/ |
79
|
|
|
abstract public function receive(Request $request, MessageContext $context); |
80
|
|
|
} |
81
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: