PowerShell scripts to check if the site collection is Host Based or Path Based

Below are  the Powershell commands to check if the site collection is either Host Based or Path. These commands would be very useful while migrating SharePoint 2010 to 2013.
  1. webApp = Get-SPWebapplication 'http://portal.mysite.com'  
  2.   
  3. foreach($spSite in $webApp.Sites)  
  4. {  
  5. if ($spSite.HostHeaderIsSiteName)   
  6. { Write-Host $spSite.Url 'is host-named' }  
  7. else  
  8. { Write-Host $spSite.Url 'is path based' }  
  9. }