FileNamingResolver\FileInfo::createPathname PHP Méthode

createPathname() public static méthode

Creates full pathname to the file / directory based on its path, basename and extension
public static createPathname ( string $path, string $basename, string $extension = '' ) : string
$path string Directory path to the file (or directory)
$basename string Base name of file without extension (or base name of directory)
$extension string [OPTIONAL] File extension (empty for directory)
Résultat string
    public static function createPathname($path, $basename, $extension = '')
    {
        $pathname = '' . static::purifyPath($path) . static::SEPARATOR_DIRECTORY . static::purifyBasename($basename);
        if ($extension) {
            $pathname .= '' . static::SEPARATOR_EXTENSION . static::purifyExtension($extension);
        }
        return $pathname;
    }

Usage Example

 public function testCreatePathname()
 {
     $path = ' /var/www/html/ ';
     $basename = ' /index/ ';
     $extension = ' .html ';
     $pathname = FileInfo::createPathname($path, $basename, $extension);
     $this->assertEquals('/var/www/html/index.html', $pathname);
 }