/** * {@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 checkNeededStatedObject(EventInterface $event) : bool { $neededStatedObject = $this->getNeededStatedObject(); if (!$neededStatedObject instanceof LifeCyclableInterface) { return true; } return $neededStatedObject === $event->getObject(); }