1 | <?php |
||
22 | class PackageDescriptor implements UrlGenerator |
||
23 | { |
||
24 | private $urlGenerator; |
||
25 | private $converter; |
||
26 | |||
27 | public function __construct(UrlGeneratorInterface $urlGenerator, QualifiedNameToUrlConverter $converter) |
||
32 | |||
33 | /** |
||
34 | * Generates a URL from the given node or returns false if unable. |
||
35 | * |
||
36 | * @param string|Descriptor\PackageDescriptor $node |
||
37 | * |
||
38 | * @return string|false |
||
39 | */ |
||
40 | 2 | public function __invoke($node) |
|
49 | } |
||
50 |
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe: