replace() public method

See also: Essence\Replacer::replace()
public replace ( $text, $template = null, array $options = [] )
$options array
    public function eventAction($idEvent)
    {
        // Formulaire barre de recherche (header)
        $formSearchBar = $this->createForm(new SearchType());
        $em = $this->getDoctrine()->getManager();
        $eventRepo = $em->getRepository('AGILHallBundle:AgilEvent');
        $event = $eventRepo->find($idEvent);
        $essence = new Essence();
        $text = '<div class="row">' . '<div class="col-lg-12">' . $event->getEventText() . '</div></div>';
        $eventContent = $essence->replace($text, function ($media) {
            return <<<HTML
\t\t\t<div class="row">
                <div class="well well-lg col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-12">
                    <p class="text-primary-blue text-center">
                        {$media->title} par
                        <a href="{$media->authorUrl}" title="Accès à la chaine de {$media->authorName}">
                            {$media->authorName}
                        </a>
                     </p>
                    <div class="embed-responsive embed-responsive-16by9">{$media->html}</div>
                </div>
\t\t    </div>
HTML;
        });
        return $this->render('AGILHallBundle:Event:event.html.twig', array('event' => $event, 'eventContent' => $eventContent, 'formSearchBar' => $formSearchBar->createView()));
    }
 /**
  *
  */
 public function testReplace()
 {
     $text = 'text';
     $template = function () {
     };
     $options = [];
     $replaced = 'replaced text';
     $Replacer = $this->getMockBuilder('\\Essence\\Replacer')->disableOriginalConstructor()->getMock();
     $Replacer->expects($this->once())->method('replace')->with($this->isEqual($text), $this->isEqual($template), $this->isEqual($options))->will($this->returnValue($replaced));
     $Essence = new Essence(['Replacer' => $Replacer]);
     $this->assertEquals($replaced, $Essence->replace($text, $template, $options));
 }