public function getCurrentEnvironment(\DNProject $project = null)
{
if ($this->getRequest()->param('Environment') === null) {
return null;
}
if ($project === null) {
$project = $this->getCurrentProject();
}
// project can still be null
if ($project === null) {
return null;
}
return $project->DNEnvironmentList()->filter('Name', $this->getRequest()->param('Environment'))->First();
}