<commit_before><?php

namespace Ivory\GoogleMapBundle\Templating\Helper;

use Ivory\GoogleMapBundle\Model\MarkerImage;

/**
 * Marker image helper allows easy rendering
 *
 * @author GeLo <<EMAIL>>
 */
class MarkerImageHelper
{
    /**
     * @var Ivory\GoogleMapBundle\Templating\Helper\PointHelper
     */
    protected $pointHelper = null;
    
    /**
     * @var Ivory\GoogleMapBundle\Templating\Helper\SizeHelper
     */
    protected $sizeHelper = null;
    
    /**
     * Create a marker image helper
     *
     * @param Ivory\GoogleMapBundle\Templating\Helper\PointHelper $pointHelper
     * @param Ivory\GoogleMapBundle\Templating\Helper\SizeHelper $sizeHelper 
     */
    public function __construct(PointHelper $pointHelper, SizeHelper $sizeHelper)
    {
        $this->pointHelper = $pointHelper;
        $this->sizeHelper = $sizeHelper;
    }
    
    /**
     * Renders the marker image
     *
     * @param Ivory\GoogleMapBundle\Model\MarkerImage $markerImage
     * @return string HTML output
     */
    public function render(MarkerImage $markerImage)
    {
        $html = sprintf('var %s = new google.maps.MarkerImage("%s"',
            $markerImage->getJavascriptVariable(),
            $markerImage->getUrl()
        );
        
        if($markerImage->hasSize())
            $html .= ', '.$this->sizeHelper->render($markerImage->getSize());
        
        if($markerImage->hasOrigin())
            $html .= ', '.$this->pointHelper->render($markerImage->getOrigin());
        
        if($markerImage->hasAnchor())
            $html .= ', '.$this->pointHelper->render($markerImage->getAnchor());
        
        if($markerImage->hasScaledSize())
            $html .= ', '.$this->sizeHelper->render($markerImage->getScaledSize());
        
        $html .= ');'.PHP_EOL;
        
        return $html;
    }
}<commit_msg>Fix marker image helper in the templating<commit_after><?php

namespace Ivory\GoogleMapBundle\Templating\Helper;

use Ivory\GoogleMapBundle\Model\MarkerImage;

/**
 * Marker image helper allows easy rendering
 *
 * @author GeLo <<EMAIL>>
 */
class MarkerImageHelper
{
    /**
     * @var Ivory\GoogleMapBundle\Templating\Helper\PointHelper
     */
    protected $pointHelper = null;
    
    /**
     * @var Ivory\GoogleMapBundle\Templating\Helper\SizeHelper
     */
    protected $sizeHelper = null;
    
    /**
     * Create a marker image helper
     *
     * @param Ivory\GoogleMapBundle\Templating\Helper\PointHelper $pointHelper
     * @param Ivory\GoogleMapBundle\Templating\Helper\SizeHelper $sizeHelper 
     */
    public function __construct(PointHelper $pointHelper, SizeHelper $sizeHelper)
    {
        $this->pointHelper = $pointHelper;
        $this->sizeHelper = $sizeHelper;
    }
    
    /**
     * Renders the marker image
     *
     * @param Ivory\GoogleMapBundle\Model\MarkerImage $markerImage
     * @return string HTML output
     */
    public function render(MarkerImage $markerImage)
    {
        $html = array();
        
        $html[] = sprintf('var %s = new google.maps.MarkerImage("%s");'.PHP_EOL,
            $markerImage->getJavascriptVariable(),
            $markerImage->getUrl()
        );
        
        if($markerImage->hasSize())
            $html[] = sprintf('%s.size = %s;'.PHP_EOL,
                $markerImage->getJavascriptVariable(),
                $this->sizeHelper->render($markerImage->getSize())
            );
        
        if($markerImage->hasOrigin())
            $html[] = sprintf('%s.origin = %s;'.PHP_EOL,
                $markerImage->getJavascriptVariable(),
                $this->pointHelper->render($markerImage->getOrigin())
            );
        
        if($markerImage->hasAnchor())
            $html[] = sprintf('%s.anchor = %s;'.PHP_EOL,
                $markerImage->getJavascriptVariable(),
                $this->pointHelper->render($markerImage->getAnchor())
            );
        
        if($markerImage->hasScaledSize())
            $html[] = sprintf('%s.scaledSize = %s;'.PHP_EOL,
                $markerImage->getJavascriptVariable(),
                $this->sizeHelper->render($markerImage->getScaledSize())
            );
        
        return implode('', $html);
    }
}
{'fraction_non_alphanumeric': 0.13909328269641585, 'fraction_numerical': 0.0, 'mean_word_length': 2.269200930954228, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 51, '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': '1443846', 'n_tokens_mistral': 1214, 'n_tokens_neox': 1204, 'n_words': 189}