<commit_before><?php
namespace Victoire\Bundle\CoreBundle\Twig\Extension;

use Symfony\Bridge\Twig\Extension\RoutingExtension;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Victoire\Bundle\PageBundle\Helper\PageHelper;

/**
 * class RoutingExtension
 */
class RoutingExtention extends RoutingExtension
{

    private $pageHelper;
    private $generator;

    public function __construct(PageHelper $pageHelper, UrlGeneratorInterface $generator)
    {
        $this->pageHelper = $pageHelper;
        $this->generator = $generator;
        parent::__construct($generator);
    }

    public function getPath($name, $parameters = array(), $relative = false)
    {
        if ($name == 'victoire_core_page_show_by_id') {
            $viewId = $parameters['viewId'];
            $entityId = $parameters['entityId'];

            $page = $this->pageHelper->findPageByParameters(array('viewId' => $viewId, 'entityId' => $entityId));

            return $this->generator->generate('victoire_core_page_show', array('url' => $page->getUrl()));
        }

        foreach ($parameters as $_key => $_value) {
            //if the value contains a curly bracket, it means that there is no entity to render with
            if (strstr($_value, '{') != null) {
                return $this->generator->generate('vic_widget_render_getStaticContent', array('path' => $name), $relative ? UrlGeneratorInterface::RELATIVE_PATH : UrlGeneratorInterface::ABSOLUTE_PATH);
            }
        }

        return $this->generator->generate($name, $parameters, $relative ? UrlGeneratorInterface::RELATIVE_PATH : UrlGeneratorInterface::ABSOLUTE_PATH);
    }
}<commit_msg>custom RoutingExtenstion check if brace in url parameters only for parameters that are strings<commit_after><?php
namespace Victoire\Bundle\CoreBundle\Twig\Extension;

use Symfony\Bridge\Twig\Extension\RoutingExtension;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Victoire\Bundle\PageBundle\Helper\PageHelper;

/**
 * class RoutingExtension
 */
class RoutingExtention extends RoutingExtension
{

    private $pageHelper;
    private $generator;

    public function __construct(PageHelper $pageHelper, UrlGeneratorInterface $generator)
    {
        $this->pageHelper = $pageHelper;
        $this->generator = $generator;
        parent::__construct($generator);
    }

    public function getPath($name, $parameters = array(), $relative = false)
    {
        if ($name == 'victoire_core_page_show_by_id') {
            $viewId = $parameters['viewId'];
            $entityId = $parameters['entityId'];

            $page = $this->pageHelper->findPageByParameters(array('viewId' => $viewId, 'entityId' => $entityId));

            return $this->generator->generate('victoire_core_page_show', array('url' => $page->getUrl()));
        }

        foreach ($parameters as $_key => $_value) {
            //if the value contains a curly bracket, it means that there is no entity to render with
            if (is_string($_value) && strstr($_value, '{') != null) {
                return $this->generator->generate('vic_widget_render_getStaticContent', array('path' => $name), $relative ? UrlGeneratorInterface::RELATIVE_PATH : UrlGeneratorInterface::ABSOLUTE_PATH);
            }
        }

        return $this->generator->generate($name, $parameters, $relative ? UrlGeneratorInterface::RELATIVE_PATH : UrlGeneratorInterface::ABSOLUTE_PATH);
    }
}
{'fraction_non_alphanumeric': 0.12663755458515283, 'fraction_numerical': 0.0, 'mean_word_length': 3.6432432432432433, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, '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': '7386793', 'n_tokens_mistral': 960, 'n_tokens_neox': 932, 'n_words': 196}