<commit_before><?php

namespace OpenOrchestra\Media\DisplayBlock\Strategies;

use OpenOrchestra\DisplayBundle\DisplayBlock\Strategies\AbstractStrategy;
use OpenOrchestra\ModelInterface\Model\ReadBlockInterface;
use OpenOrchestra\ModelInterface\Repository\ReadNodeRepositoryInterface;
use Symfony\Component\HttpFoundation\Response;

/**
 * Class DisplayMediaStrategy
 */
class DisplayMediaStrategy extends AbstractStrategy
{
    const DISPLAY_MEDIA = "display_media";

    protected $nodeRepository;
    protected $template;

    /**
     * @param ReadNodeRepositoryInterface $nodeRepository
     * @param string                      $template
     */
    public function __construct(ReadNodeRepositoryInterface $nodeRepository, $template)
    {
        $this->nodeRepository = $nodeRepository;
        $this->template = $template;
    }

    /**
     * Check if the strategy support this block
     *
     * @param ReadBlockInterface $block
     *
     * @return boolean
     */
    public function support(ReadBlockInterface $block)
    {
        return self::DISPLAY_MEDIA == $block->getComponent();
    }

    /**
     * Perform the show action for a block
     *
     * @param ReadBlockInterface $block
     *
     * @return Response
     */
    public function show(ReadBlockInterface $block)
    {
        $linkUrl = null;
        $nodeToLink = $block->getAttribute('nodeToLink');

        if (!empty($nodeToLink)) {
            $language = $this->currentSiteManager->getCurrentSiteDefaultLanguage();
            $siteId = $this->currentSiteManager->getCurrentSiteId();
            $linkUrl = $this->nodeRepository->findOnePublishedByNodeIdAndLanguageAndSiteIdInLastVersion($nodeToLink, $language, $siteId);
        }

        $parameters = array(
            'imageFormat' => $block->getAttribute('imageFormat'),
            'picture' => $block->getAttribute('picture'),
            'linkUrl' => $linkUrl,
            'id' => $block->getId(),
            'class' => $block->getClass()
        );

        return $this->render($this->template, $parameters);
    }
<commit_msg>update node repository method names<commit_after><?php

namespace OpenOrchestra\Media\DisplayBlock\Strategies;

use OpenOrchestra\DisplayBundle\DisplayBlock\Strategies\AbstractStrategy;
use OpenOrchestra\ModelInterface\Model\ReadBlockInterface;
use OpenOrchestra\ModelInterface\Repository\ReadNodeRepositoryInterface;
use Symfony\Component\HttpFoundation\Response;

/**
 * Class DisplayMediaStrategy
 */
class DisplayMediaStrategy extends AbstractStrategy
{
    const DISPLAY_MEDIA = "display_media";

    protected $nodeRepository;
    protected $template;

    /**
     * @param ReadNodeRepositoryInterface $nodeRepository
     * @param string                      $template
     */
    public function __construct(ReadNodeRepositoryInterface $nodeRepository, $template)
    {
        $this->nodeRepository = $nodeRepository;
        $this->template = $template;
    }

    /**
     * Check if the strategy support this block
     *
     * @param ReadBlockInterface $block
     *
     * @return boolean
     */
    public function support(ReadBlockInterface $block)
    {
        return self::DISPLAY_MEDIA == $block->getComponent();
    }

    /**
     * Perform the show action for a block
     *
     * @param ReadBlockInterface $block
     *
     * @return Response
     */
    public function show(ReadBlockInterface $block)
    {
        $linkUrl = null;
        $nodeToLink = $block->getAttribute('nodeToLink');

        if (!empty($nodeToLink)) {
            $language = $this->currentSiteManager->getCurrentSiteDefaultLanguage();
            $siteId = $this->currentSiteManager->getCurrentSiteId();
            $linkUrl = $this->nodeRepository->findPublishedInLastVersion($nodeToLink, $language, $siteId);
        }

        $parameters = array(
            'imageFormat' => $block->getAttribute('imageFormat'),
            'picture' => $block->getAttribute('picture'),
            'linkUrl' => $linkUrl,
            'id' => $block->getId(),
            'class' => $block->getClass()
        );

        return $this->render($this->template, $parameters);
    }

{'fraction_non_alphanumeric': 0.11456077015643802, 'fraction_numerical': 0.0, 'mean_word_length': 2.880485527544351, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 45, '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': '5212893', 'n_tokens_mistral': 1086, 'n_tokens_neox': 1091, 'n_words': 210}