bingo-soft /
jabe
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace Jabe\Impl\Cmd; |
||||
| 4 | |||||
| 5 | use Jabe\Impl\Interceptor\{ |
||||
| 6 | CommandInterface, |
||||
| 7 | CommandContext |
||||
| 8 | }; |
||||
| 9 | use Jabe\Impl\Persistence\Entity\ExecutionEntity; |
||||
| 10 | use Jabe\Impl\Util\EnsureUtil; |
||||
| 11 | |||||
| 12 | class GetExecutionVariablesCmd implements CommandInterface, \Serializable |
||||
| 13 | { |
||||
| 14 | protected $executionId; |
||||
| 15 | protected $variableNames; |
||||
| 16 | protected $isLocal; |
||||
| 17 | protected $deserializeValues; |
||||
| 18 | |||||
| 19 | public function __construct(string $executionId, array $variableNames, bool $isLocal, bool $deserializeValues) |
||||
| 20 | { |
||||
| 21 | $this->executionId = $executionId; |
||||
| 22 | $this->variableNames = $variableNames; |
||||
| 23 | $this->isLocal = $isLocal; |
||||
| 24 | $this->deserializeValues = $deserializeValues; |
||||
| 25 | } |
||||
| 26 | |||||
| 27 | public function serialize() |
||||
| 28 | { |
||||
| 29 | return json_encode([ |
||||
| 30 | 'executionId' => $this->executionId, |
||||
| 31 | 'variableNames' => $this->variableNames, |
||||
| 32 | 'isLocal' => $this->isLocal, |
||||
| 33 | 'deserializeValue' => $this->deserializeValue |
||||
| 34 | ]); |
||||
| 35 | } |
||||
| 36 | |||||
| 37 | public function unserialize($data) |
||||
| 38 | { |
||||
| 39 | $json = json_decode($data); |
||||
| 40 | $this->executionId = $json->executionId; |
||||
| 41 | $this->variableNames = $json->variableNames; |
||||
| 42 | $this->isLocal = $json->isLocal; |
||||
| 43 | $this->deserializeValue = $json->deserializeValue; |
||||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||||
| 44 | } |
||||
| 45 | |||||
| 46 | public function execute(CommandContext $commandContext) |
||||
| 47 | { |
||||
| 48 | EnsureUtil::ensureNotNull("executionId", "executionId", $this->executionId); |
||||
| 49 | |||||
| 50 | $execution = $commandContext |
||||
| 51 | ->getExecutionManager() |
||||
| 52 | ->findExecutionById($this->executionId); |
||||
| 53 | |||||
| 54 | EnsureUtil::ensureNotNull("execution " . $this->executionId . " doesn't exist", "execution", $execution); |
||||
| 55 | |||||
| 56 | $this->checkGetExecutionVariables($execution, $commandContext); |
||||
| 57 | |||||
| 58 | $executionVariables = new VariableMapImpl(); |
||||
| 59 | |||||
| 60 | // collect variables from execution |
||||
| 61 | $execution->collectVariables($executionVariables, $this->variableNames, $this->isLocal, $this->deserializeValues); |
||||
| 62 | |||||
| 63 | return $executionVariables; |
||||
| 64 | } |
||||
| 65 | |||||
| 66 | protected function checkGetExecutionVariables(ExecutionEntity $execution, CommandContext $commandContext): void |
||||
| 67 | { |
||||
| 68 | foreach ($commandContext->getProcessEngineConfiguration()->getCommandCheckers() as $checker) { |
||||
|
0 ignored issues
–
show
The method
getCommandCheckers() does not exist on Jabe\Impl\Cfg\ProcessEngineConfigurationImpl.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||||
| 69 | $checker->checkReadProcessInstanceVariable($execution); |
||||
| 70 | } |
||||
| 71 | } |
||||
| 72 | } |
||||
| 73 |