private function buildLoopVariables()
    {
        /* @var \Twig_Node_Expression_Array $options */
        $options = $this->getAttribute('options');
        $loop = $this->getAttribute('loop');
        $loopKey = '';
        $loopId = null;
        $hasId = false;

        if (!empty($loop)) {
            foreach ($options->getKeyValuePairs() as $val) {
                /* @var \Twig_Node_Expression_Constant $key */
                $key = $val['key'];
                $value = $val['value'];

                if ('id' === $key->getAttribute('value')) {
                    $hasId = true;

                    if ($value instanceof \Twig_Node_Expression_Constant) {
                        $loopKey = ', $key';
                        $loopId = $value->getAttribute('value');
                        break;
                    }
                }
            }

            if (!$hasId) {
                $loopKey = ', $key';
                $loopId = $this->getAttribute('name');
            }
        }

        return [$loopKey, $loopId];
    }