You are here

DummyCoder.php in Facets Pretty Paths 8

File

tests/modules/facets_pretty_paths_test/src/Plugin/facets_pretty_paths/coder/DummyCoder.php
View source
<?php

namespace Drupal\facets_pretty_paths_test\Plugin\facets_pretty_paths\coder;

use Drupal\facets_pretty_paths\Coder\CoderPluginBase;

/**
 * A dummy coder.
 *
 * @FacetsPrettyPathsCoder(
 *   id = "dummy_coder",
 *   label = @Translation("Dummy"),
 *   description = @Translation("A dummy coder used for testing")
 * )
 */
class DummyCoder extends CoderPluginBase {

  /**
   * {@inheritdoc}
   */
  public function encode($id) {
    return "dummy-{$id}";
  }

  /**
   * {@inheritdoc}
   */
  public function decode($alias) {
    $exploded = explode('-', $alias);
    return $exploded[1];
  }

}

Classes

Namesort descending Description
DummyCoder A dummy coder.