1 | <?php |
||
14 | class AuthorizedCommandBus extends CommandBusDecoratorBase implements AuthorizedCommandBusInterface, LoggerAwareInterface, ContextAwareInterface |
||
15 | { |
||
16 | /** |
||
17 | * @var Metadata |
||
18 | */ |
||
19 | protected $metadata; |
||
20 | |||
21 | /** |
||
22 | * @var UserIdentificationInterface |
||
23 | */ |
||
24 | private $userIdentification; |
||
25 | |||
26 | /** |
||
27 | * @var SecurityInterface |
||
28 | */ |
||
29 | private $security; |
||
30 | |||
31 | /** |
||
32 | * AuthorizedCommandBus constructor. |
||
33 | * @param CommandBusInterface $decoratee |
||
34 | * @param UserIdentificationInterface $userIdentification |
||
35 | * @param SecurityInterface $security |
||
36 | */ |
||
37 | public function __construct( |
||
47 | |||
48 | /** |
||
49 | * @inheritdoc |
||
50 | */ |
||
51 | public function dispatch($command) |
||
68 | |||
69 | /** |
||
70 | * @inheritdoc |
||
71 | */ |
||
72 | public function isAuthorized(AuthorizableCommandInterface $command) |
||
76 | |||
77 | /** |
||
78 | * @return UserIdentificationInterface |
||
79 | */ |
||
80 | public function getUserIdentification() |
||
84 | |||
85 | /** |
||
86 | * Sets a logger instance on the object. |
||
87 | * |
||
88 | * @param LoggerInterface $logger |
||
89 | * |
||
90 | * @return void |
||
91 | */ |
||
92 | public function setLogger(LoggerInterface $logger) |
||
96 | |||
97 | /** |
||
98 | * @param Metadata|null $context |
||
99 | */ |
||
100 | public function setContext(Metadata $context = null) |
||
108 | } |
||
109 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: