These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * phpDocumentor |
||
4 | * |
||
5 | * PHP Version 5.4 |
||
6 | * |
||
7 | * @copyright 2010-2014 Mike van Riel / Naenius (http://www.naenius.com) |
||
8 | * @license http://www.opensource.org/licenses/mit-license.php MIT |
||
9 | * @link http://phpdoc.org |
||
10 | */ |
||
11 | |||
12 | namespace phpDocumentor\Application\Renderer\Router; |
||
13 | |||
14 | use phpDocumentor\Configuration; |
||
15 | use phpDocumentor\DomainModel\Renderer\Router\Rule; |
||
16 | use phpDocumentor\DomainModel\Renderer\Router\RouterAbstract; |
||
17 | |||
18 | /** |
||
19 | * Connects class, interface and traits to remote documentation sets. |
||
20 | */ |
||
21 | class ExternalRouter extends RouterAbstract |
||
22 | { |
||
23 | /** @var Configuration */ |
||
24 | protected $configuration; |
||
25 | |||
26 | /** |
||
27 | * Registers the application configuration with this router. |
||
28 | * |
||
29 | * The configuration is used to extract which external routes to add to the application. |
||
30 | * |
||
31 | * @param Configuration $configuration |
||
32 | */ |
||
33 | public function __construct(Configuration $configuration) |
||
34 | { |
||
35 | $this->configuration = $configuration; |
||
36 | |||
37 | parent::__construct(); |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * Configuration function to add routing rules to a router. |
||
42 | * |
||
43 | * @return void |
||
44 | */ |
||
45 | public function configure() |
||
46 | { |
||
47 | // TODO: Replace this |
||
48 | return; |
||
49 | $docs = $this->configuration->getTransformer()->getExternalClassDocumentation(); |
||
0 ignored issues
–
show
|
|||
50 | foreach ($docs as $external) { |
||
51 | $prefix = (string) $external->getPrefix(); |
||
52 | $uri = (string) $external->getUri(); |
||
53 | |||
54 | $this[] = new Rule( |
||
55 | function ($node) use ($prefix) { |
||
56 | return (is_string($node) && (strpos(ltrim($node, '\\'), $prefix) === 0)); |
||
57 | }, |
||
58 | function ($node) use ($uri) { |
||
59 | return str_replace('{CLASS}', ltrim($node, '\\'), $uri); |
||
60 | } |
||
61 | ); |
||
62 | } |
||
63 | } |
||
64 | } |
||
65 |
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.
Unreachable code is most often the result of
return
,die
orexit
statements that have been added for debug purposes.In the above example, the last
return false
will never be executed, because a return statement has already been met in every possible execution path.