As far as I can tell Yii::app()->request isn’t documented anywhere, I just stumbled across it. When I read the documentation on CHttpRequest it seems like my code should work. hostInfo is a property of CHttpRequest.
The code above works because an instance of the web application is created(look at your index.php) and the "hostInfo" property is populated with a value.
The code below seems to be not valid. The property "hostInfo" is declared as private and you can only access it from within the class itself. Plus, if you want to access a property/method from a static context, you use :: instead of ->