DNRoot::getCurrentEnvironment PHP Method

getCurrentEnvironment() public method

public getCurrentEnvironment ( DNProject $project = null ) : DNEnvironment | null
$project DNProject
return DNEnvironment | null
    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();
    }