replace() public method

Replaces absolute URLs with placeholder
public replace ( array $entity ) : array
$entity array
return array
Exemplo n.º 1
0
 /**
  * Chooses an appropriate storage and calls its {@see VersionPress\Storages\Storage::save() save()} method.
  *
  * @see Storage::save()
  *
  * @param string $entityName Entity type determines the storage used
  * @param array $data Data passed to the `VersionPress\Storages\Storage::save()` method
  */
 public function save($entityName, $data)
 {
     $storage = $this->storageFactory->getStorage($entityName);
     if ($storage == null) {
         return;
     }
     $data = $this->urlReplacer->replace($data);
     $changeInfo = $storage->save($data);
     if ($changeInfo) {
         $this->changeList[] = $changeInfo;
     }
 }
 /**
  * @test
  * @dataProvider entityDataProvider
  *
  * @param $entity
  * @param $entityWithReplacedUrls
  */
 public function itReplacesUrlWithPlaceholder($entity, $entityWithReplacedUrls)
 {
     $result = $this->filter->replace($entity);
     $this->assertEquals($entityWithReplacedUrls, $result);
 }