protected function createState(array $state_definition)
    {
        $state_implementor = isset($state_definition['class']) ? $state_definition['class'] : State::CLASS;
        $this->loadStateImplementor($state_implementor);

        $state = $this->service_locator->make(
            $state_implementor,
            [
                ':name' => $state_definition['name'],
                ':type' => $state_definition['type'],
                ':options' => $state_definition['options'],
            ]
        );

        if (!$state instanceof StateInterface) {
            throw new RuntimeError(
                sprintf(
                    'Configured implementor "%s" for state "%s" must implement: %s',
                    $state_implementor,
                    $state_definition['name'],
                    StateInterface::CLASS
                )
            );
        }

        return $state;
    }