protected function parseStateMachineDefitions()
    {
        $defs = $this->getOption('state_machine_definition');
        if ($defs instanceof ImmutableOptionsInterface) {
            return $defs->toArray();
        } elseif (is_array($defs)) {
            return $defs;
        }

        if (!is_string($defs)) {
            throw new RuntimeError(
                'Option "state_machine_definition" must be a path to an xml file ' .
                'or already parsed definitions provided as an array.'
            );
        }
        $parser = new StateMachineDefinitionParser();

        return $parser->parse($defs);
    }