/** * {@inheritdoc} */ public function getToken(EventInterface $event) : array { $object = $event->getObject(); $statedClassName = $this->getStatedClassInstanceToken($object); $tokenList = [$statedClassName]; foreach ($event->getEnabledStates() as $stateName) { $tokenList[] = $statedClassName . ':' . \strtolower($stateName); } foreach ($event->getIncomingStates() as $stateName) { $tokenList[] = $statedClassName . ':+' . \strtolower($stateName); } foreach ($event->getOutgoingStates() as $stateName) { $tokenList[] = $statedClassName . ':-' . \strtolower($stateName); } return $tokenList; }
/** * @param EventInterface $event * * @return bool */ protected function checkNeededIncomingStates(EventInterface $event) : bool { $neededIncomingStatesList = $this->listNeededIncomingStates(); if (empty($neededIncomingStatesList)) { return true; } $incomingStateList = $event->getIncomingStates(); return empty(\array_diff($neededIncomingStatesList, $incomingStateList)); }