Platformsh\Cli\Helper\FilesystemHelper::getHomeDirectory PHP Méthode

getHomeDirectory() public static méthode

public static getHomeDirectory ( ) : string
Résultat string The absolute path to the user's home directory.
    public static function getHomeDirectory()
    {
        $home = getenv('HOME');
        if (empty($home)) {
            // Windows compatibility.
            if ($userProfile = getenv('USERPROFILE')) {
                $home = $userProfile;
            } elseif (!empty($_SERVER['HOMEDRIVE']) && !empty($_SERVER['HOMEPATH'])) {
                $home = $_SERVER['HOMEDRIVE'] . $_SERVER['HOMEPATH'];
            }
        }
        return $home;
    }

Usage Example

 /**
  * @return string
  */
 protected function getHomeDir()
 {
     if (!isset(self::$homeDir)) {
         $fs = new FilesystemHelper();
         self::$homeDir = $fs->getHomeDirectory();
     }
     return self::$homeDir;
 }
All Usage Examples Of Platformsh\Cli\Helper\FilesystemHelper::getHomeDirectory