public function setRoute($route, IStateMachine $machine = null)
    {
        if (is_array($route)) {
            $this[static::FIELD__ROUTE] = $route;
        } elseif (is_object($route) && ($route instanceof IStatesRoute)) {
            $this[static::FIELD__ROUTE] = $route[static::FIELD__ROUTE];
        } else {
            throw new \Exception('Unsupported route type "' . gettype($route) . '".');
        }

        $this->packToMachine($machine);

        return $this;
    }
public function setRoute($route, IStateMachine $machine = null)
    {
        if (is_array($route)) {
            $this[static::FIELD__ROUTE] = $route;
        } elseif (is_object($route) && ($route instanceof IStatesRoute)) {
            $this[static::FIELD__ROUTE] = $route[static::FIELD__ROUTE];
        } else {
            throw new \Exception('Unsupported route type "' . gettype($route) . '".');
        }

        $this->packToMachine($machine);

        return $this;
    }
@param array|IStatesRoute $route
@param $machine

@return $this
@throws \Exception