public static function extract($yamlArray, $key, $needed = false)
    {
        if (!empty($yamlArray) && array_key_exists($key, $yamlArray))
            return $yamlArray[$key];

        if ($needed) {
            throw new \Deployer\Exception\Exception(
                'Cannot find the setting: ' . $key . '. This key needs to be given!'
            );
        }

        return null; // The key was not needed, so continue!
    }