/**
  * Configuration function to add routing rules to a router.
  *
  * @return void
  */
 public function configure()
 {
     $docs = $this->configuration->getTransformer()->getExternalClassDocumentation();
     foreach ($docs as $external) {
         $prefix = (string) $external->getPrefix();
         $uri = (string) $external->getUri();
         $this[] = new Rule(function ($node) use($prefix) {
             return is_string($node) && strpos(ltrim($node, '\\'), $prefix) === 0;
         }, function ($node) use($uri) {
             return str_replace('{CLASS}', ltrim($node, '\\'), $uri);
         });
     }
 }
 /**
  * @covers phpDocumentor\Transformer\Router\ExternalRouter::__construct
  * @covers phpDocumentor\Transformer\Router\ExternalRouter::configure
  * @covers phpDocumentor\Transformer\Router\ExternalRouter::match
  */
 public function testIfMultipleDefinitionsGenerateAnUrl()
 {
     // Arrange
     $config = new Configuration();
     $config->getTransformer()->setExternalClassDocumentation(array(new ExternalClassDocumentation('My_Zen_Space', 'http://abc/zen/{CLASS}.html'), new ExternalClassDocumentation('My_Space', 'http://abc/{CLASS}.html')));
     $router = new ExternalRouter($config);
     // Act
     $result = $router->match('My_Space_With_Suffix')->generate('My_Space_With_Suffix');
     // Assert
     $this->assertSame('http://abc/My_Space_With_Suffix.html', $result);
 }
 /**
  * @covers phpDocumentor\Configuration::__construct
  * @covers phpDocumentor\Configuration::getTransformer
  */
 public function testIfTransformerConfigurationIsReturned()
 {
     $this->assertInstanceOf('phpDocumentor\\Transformer\\Configuration', $this->fixture->getTransformer());
 }