<commit_before><?php

namespace Ivory\GoogleMapBundle\Templating\Helper;

use Ivory\GoogleMapBundle\Model\Event;

/**
 * Event helper allows easy rendering
 *
 * @author GeLo <<EMAIL>>
 */
class EventHelper
{   
    /**
     * Renders the javascript dom event
     *
     * @param Ivory\GoogleMapBundle\Model\Event $domEvent
     * @return string HTML output 
     */
    public function renderDomEvent(Event $domEvent)
    {
        return sprintf('google.maps.event.addDomListener(%s, "%s", %s, %s);'.PHP_EOL,
            $domEvent->getInstance(),
            $domEvent->getEventName(),
            $domEvent->getHandle(),
            $domEvent->isCapture()
        );
    }
    
    /**
     * Renders the javascript dom event once
     *
     * @param Ivory\GoogleMapBundle\Model\Event $domEventOnce
     * @return string HTML output 
     */
    public function renderDomEventOnce(Event $domEventOnce)
    {
        return sprintf('google.maps.event.addDomListenerOnce(%s, "%s", %s, %s);'.PHP_EOL,
            $domEventOnce->getInstance(),
            $domEventOnce->getEventName(),
            $domEventOnce->getHandle(),
            $domEventOnce->isCapture()
        );
    }
    
    /**
     * Renders the javascript event
     *
     * @param Ivory\GoogleMapBundle\Model\Event $event
     * @return string HTML output 
     */
    public function renderEvent(Event $event)
    {
        return sprintf('google.maps.event.addListener(%s, "%s", %s);'.PHP_EOL,
            $event->getInstance(),
            $event->getEventName(),
            $event->getHandle()
        );
    }
    
    /**
     * Renders the javascript event once
     *
     * @param Ivory\GoogleMapBundle\Model\Event $eventOnce
     * @return string HTML output 
     */
    public function renderEventOnce(Event $eventOnce)
    {
        return sprintf('google.maps.event.addListenerOnce(%s, "%s", %s);'.PHP_EOL,
            $eventOnce->getInstance(),
            $eventOnce->getEventName(),
            $eventOnce->getHandle()
        );
    }
}
<commit_msg>Update EventHelper to uses the event javascript variable<commit_after><?php

namespace Ivory\GoogleMapBundle\Templating\Helper;

use Ivory\GoogleMapBundle\Model\Event;

/**
 * Event helper allows easy rendering
 *
 * @author GeLo <<EMAIL>>
 */
class EventHelper
{   
    /**
     * Renders the javascript dom event
     *
     * @param Ivory\GoogleMapBundle\Model\Event $domEvent
     * @return string HTML output 
     */
    public function renderDomEvent(Event $domEvent)
    {
        return sprintf('%s = google.maps.event.addDomListener(%s, "%s", %s, %s);'.PHP_EOL,
            $domEvent->getJavascriptVariable(),
            $domEvent->getInstance(),
            $domEvent->getEventName(),
            $domEvent->getHandle(),
            $domEvent->isCapture()
        );
    }
    
    /**
     * Renders the javascript dom event once
     *
     * @param Ivory\GoogleMapBundle\Model\Event $domEventOnce
     * @return string HTML output 
     */
    public function renderDomEventOnce(Event $domEventOnce)
    {
        return sprintf('%s = google.maps.event.addDomListenerOnce(%s, "%s", %s, %s);'.PHP_EOL,
            $domEventOnce->getJavascriptVariable(),
            $domEventOnce->getInstance(),
            $domEventOnce->getEventName(),
            $domEventOnce->getHandle(),
            $domEventOnce->isCapture()
        );
    }
    
    /**
     * Renders the javascript event
     *
     * @param Ivory\GoogleMapBundle\Model\Event $event
     * @return string HTML output 
     */
    public function renderEvent(Event $event)
    {
        return sprintf('%s = google.maps.event.addListener(%s, "%s", %s);'.PHP_EOL,
            $event->getJavascriptVariable(),
            $event->getInstance(),
            $event->getEventName(),
            $event->getHandle()
        );
    }
    
    /**
     * Renders the javascript event once
     *
     * @param Ivory\GoogleMapBundle\Model\Event $eventOnce
     * @return string HTML output 
     */
    public function renderEventOnce(Event $eventOnce)
    {
        return sprintf('%s = google.maps.event.addListenerOnce(%s, "%s", %s);'.PHP_EOL,
            $eventOnce->getJavascriptVariable(),
            $eventOnce->getInstance(),
            $eventOnce->getEventName(),
            $eventOnce->getHandle()
        );
    }
}

{'fraction_non_alphanumeric': 0.13274948144733809, 'fraction_numerical': 0.0, 'mean_word_length': 2.224368499257058, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4990206', 'n_tokens_mistral': 1279, 'n_tokens_neox': 1258, 'n_words': 237}