Example #1
0
 /**
  * @param Tx_Asdis_Content_Replacement_Map $replacementMap
  * @param string $content
  * @return string
  */
 public function replace(Tx_Asdis_Content_Replacement_Map $replacementMap, $content)
 {
     $result = preg_replace($replacementMap->getSources(), $replacementMap->getTargets(), $content);
     if (NULL === $result) {
         return $content;
     }
     return $result;
 }
Example #2
0
 /**
  * @test
  */
 public function testAll()
 {
     $source1 = 'AAA';
     $target1 = 'BBB';
     $source2 = 'XXX';
     $target2 = 'YYY';
     $this->map->addMapping($source1, $target1);
     $this->map->addMapping($source2, $target2);
     $sources = $this->map->getSources();
     $targets = $this->map->getTargets();
     $this->assertInternalType('array', $sources);
     $this->assertInternalType('array', $targets);
     $this->assertEquals(2, sizeof($sources));
     $this->assertEquals(2, sizeof($targets));
     $this->assertEquals($source1, $sources[0]);
     $this->assertEquals($source2, $sources[1]);
     $this->assertEquals($target1, $targets[0]);
     $this->assertEquals($target2, $targets[1]);
 }