ExternalRouter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 35
ccs 0
cts 16
cp 0
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A configure() 0 17 3
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * This file is part of phpDocumentor.
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @author    Mike van Riel <[email protected]>
11
 * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com)
12
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
13
 * @link      http://phpdoc.org
14
 */
15
16
namespace phpDocumentor\Transformer\Router;
17
18
/**
19
 * Connects class, interface and traits to remote documentation sets.
20
 */
21
class ExternalRouter extends RouterAbstract
22
{
23
//    /**
24
//     * Registers the application configuration with this router.
25
//     *
26
//     * The configuration is used to extract which external routes to add to the application.
27
//     */
28
//    public function __construct(Configuration $configuration)
29
//    {
30
//        $this->configuration = $configuration;
31
//
32
//        parent::__construct();
33
//    }
34
35
    /**
36
     * Configuration function to add routing rules to a router.
37
     */
38
    public function configure()
39
    {
40
        $docs = []; //$this->configuration->getTransformer()->getExternalClassDocumentation();
41
        foreach ($docs as $external) {
42
            $prefix = (string) $external->getPrefix();
43
            $uri = (string) $external->getUri();
44
45
            $this[] = new Rule(
46
                function ($node) use ($prefix) {
47
                    return is_string($node) && (strpos(ltrim($node, '\\'), $prefix) === 0);
48
                },
49
                function ($node) use ($uri) {
50
                    return str_replace('{CLASS}', ltrim($node, '\\'), $uri);
51
                }
52
            );
53
        }
54
    }
55
}
56