public function can(string $command, Who $who = null): bool
    {
        /** @var Transition|null $transition */
        $transition = $this->definition->getTransitions()->first(
            function (Transition $defined) use ($command) {
                return $command === $defined->getName();
            }
        );

        if (null === $transition) {
            return false;
        }

        $who = $who ?? new Anybody;

        return null !== $transition->getRoutes()->first(
            function (Route $route) use ($who) {
                return $route->isFrom($this->subject->getState()) &&
                    ($route->isAllowedForAnybody() || $route->isAllowed($who));
            }
        );
    }
public function can(string $command, Who $who = null): bool
    {
        /** @var Transition|null $transition */
        $transition = $this->definition->getTransitions()->first(
            function (Transition $defined) use ($command) {
                return $command === $defined->getName();
            }
        );

        if (null === $transition) {
            return false;
        }

        $who = $who ?? new Anybody;

        return null !== $transition->getRoutes()->first(
            function (Route $route) use ($who) {
                return $route->isFrom($this->subject->getState()) &&
                    ($route->isAllowedForAnybody() || $route->isAllowed($who));
            }
        );
    }
@param string   $command
@param Who|null $who

@return bool