for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* @author Mike van Riel <[email protected]>
* @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
namespace phpDocumentor\Transformer\Router\UrlGenerator\Standard;
use phpDocumentor\Descriptor;
use phpDocumentor\Transformer\Router\UrlGenerator\UrlGeneratorInterface;
class FileDescriptor implements UrlGeneratorInterface
{
* Generates a URL from the given node or returns false if unable.
* @param string|Descriptor\FileDescriptor $node
* @return string|false
public function __invoke($node)
$converter = new QualifiedNameToUrlConverter();
return '/files/' . $converter->fromFile($node->getPath()) . '.html';
$node
string
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(); } }
}
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe: