How to get environment in Symfony2

In the controller use:

$this->get('kernel')->getEnvironment()