Completed
Push — develop ( 8eb671...133594 )
by Mike
19:30 queued 09:24
created

FunctionDescriptor   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 6 1
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\UrlGenerator\Standard;
17
18
use phpDocumentor\Descriptor;
19
use phpDocumentor\Transformer\Router\UrlGenerator\UrlGeneratorInterface;
20
21
/**
22
 * Generates a relative URL with functions for use in the generated HTML documentation..
23
 */
24
class FunctionDescriptor implements UrlGeneratorInterface
25
{
26
    /**
27
     * Generates a URL from the given node or returns false if unable.
28
     *
29
     * @param string|Descriptor\FunctionDescriptor $node
30
     *
31
     * @return string|false
32
     */
33 2
    public function __invoke($node)
34
    {
35 2
        $converter = new QualifiedNameToUrlConverter();
36
37 2
        return '/namespaces/' . $converter->fromNamespace($node->getNamespace()) . '.html#function_' . $node->getName();
0 ignored issues
show
Bug introduced by
It seems like $node is not always an object, but can also be of type string. Maybe add an additional type check?

If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe:

function someFunction(A $objectMaybe = null)
{
    if ($objectMaybe instanceof A) {
        $objectMaybe->doSomething();
    }
}
Loading history...
38
    }
39
}
40