private function doControlEncode($type, Control $control, Encoder $encoder)
    {
        return sprintf(
            '%s = L.control.%s(%s);',
            $encoder->encodeReference($control),
            $type,
            $encoder->encodeArguments(array($control->getOptions()))
        );
    }