<commit_before><?php

namespace PHPOrchestra\ModelBundle\Twig;

use PHPOrchestra\ModelBundle\DisplayMedia\DisplayMediaManager;
use PHPOrchestra\ModelBundle\Model\MediaInterface;
use PHPOrchestra\ModelBundle\Repository\MediaRepository;

/**
 * Class DisplayMediaExtension
 */
class DisplayMediaExtension extends \Twig_Extension
{
    protected $displayMediaManager;
    protected $mediaRepository;

    /**
     * @param DisplayMediaManager $displayMediaManager
     * @param MediaRepository     $mediaRepository
     */
    public function __construct(DisplayMediaManager $displayMediaManager, MediaRepository $mediaRepository)
    {
        $this->displayMediaManager = $displayMediaManager;
        $this->mediaRepository = $mediaRepository;

    }

    /**
     * @return array
     */
    public function getFunctions()
    {
        return array(
            new \Twig_SimpleFunction('media_mym_type', array($this, 'mediaMymType'), array('is_safe' => array('html'))),
            new \Twig_SimpleFunction('display_media', array($this, 'displayMedia')),
        );
    }

    /**
     * @param String $mediaId
     *
     * @return String
     */
    public function displayMedia($mediaId)
    {
        $media = $this->mediaRepository->findOneById($mediaId);

        if ($media) {
            return $this->displayMediaManager->displayMedia($media);
        } else {
            return '';
        }
    }

    /**
     * @param String $mediaId
     *
     * @return String
     */
    public function mediaPreview($mediaId)
    {
        $media = $this->mediaRepository->findOneById($mediaId);
<commit_msg>fix name error<commit_after><?php

namespace PHPOrchestra\ModelBundle\Twig;

use PHPOrchestra\ModelBundle\DisplayMedia\DisplayMediaManager;
use PHPOrchestra\ModelBundle\Model\MediaInterface;
use PHPOrchestra\ModelBundle\Repository\MediaRepository;

/**
 * Class DisplayMediaExtension
 */
class DisplayMediaExtension extends \Twig_Extension
{
    protected $displayMediaManager;
    protected $mediaRepository;

    /**
     * @param DisplayMediaManager $displayMediaManager
     * @param MediaRepository     $mediaRepository
     */
    public function __construct(DisplayMediaManager $displayMediaManager, MediaRepository $mediaRepository)
    {
        $this->displayMediaManager = $displayMediaManager;
        $this->mediaRepository = $mediaRepository;

    }

    /**
     * @return array
     */
    public function getFunctions()
    {
        return array(
            new \Twig_SimpleFunction('display_media', array($this, 'displayMedia'), array('is_safe' => array('html'))),
            new \Twig_SimpleFunction('media_preview', array($this, 'mediaPreview')),
        );
    }

    /**
     * @param String $mediaId
     *
     * @return String
     */
    public function displayMedia($mediaId)
    {
        $media = $this->mediaRepository->findOneById($mediaId);

        if ($media) {
            return $this->displayMediaManager->displayMedia($media);
        } else {
            return '';
        }
    }

    /**
     * @param String $mediaId
     *
     * @return String
     */
    public function mediaPreview($mediaId)
    {
        $media = $this->mediaRepository->findOneById($mediaId);

{'fraction_non_alphanumeric': 0.11469311841289523, 'fraction_numerical': 0.0, 'mean_word_length': 2.855436081242533, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '3213453', 'n_tokens_mistral': 872, 'n_tokens_neox': 869, 'n_words': 158}