1 | <?php |
||
22 | class SplittingServiceActivator extends \PEIP\Service\ServiceActivator |
||
23 | { |
||
24 | /** |
||
25 | * Calls a method on a service (registered as a callable) with |
||
26 | * content/payload (array) of given message as arguments. |
||
27 | * |
||
28 | * @param \PEIP\INF\Message\Message $message message to call the service with it�s content/payload |
||
29 | * |
||
30 | * @return mixed result of calling the registered service callable with message content/payload |
||
31 | */ |
||
32 | public function callService(\PEIP\INF\Message\Message $message) |
||
42 | } |
||
43 |
If you define a variable conditionally, it can happen that it is not defined for all execution paths.
Let’s take a look at an example:
In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.
Available Fixes
Check for existence of the variable explicitly:
Define a default value for the variable:
Add a value for the missing path: