code: private function expandHomeDirectory(string $path): string
      {
          return getenv('HOME') . DIRECTORY_SEPARATOR . substr($path, 2, strlen($path));
      }
docs: Expands home director '~/' to the full path to the home directory of the user who is executing the command.