If default is set to null, will return the whatever value was found

http://stackoverflow.com/questions/6038236/http-accept-language
@param string $default
@return mixed|string
540625
protected function getPreferredLanguage($default='en-US')
    {
        $acceptedLanguages = $this->getServerCollection()->get('HTTP_ACCEPT_LANGUAGE');

        // regex inspired from @GabrielAnderson on http://stackoverflow.com/questions/6038236/http-accept-language
        preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})*)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $acceptedLanguages, $lang_parse);
        $langs = $lang_parse[1];
        $ranks = $lang_parse[4];

        // (create an associative array 'language' => 'preference')
        $lang2pref = array();
        for($i=0; $i<count($langs); $i++) {
            $lang2pref[$langs[$i]] = (float) (!empty($ranks[$i]) ? $ranks[$i] : 1);
        }

        // (comparison function for uksort)
        $cmpLangs = function ($a, $b) use ($lang2pref) {
            if ($lang2pref[$a] > $lang2pref[$b])
                return -1;
            elseif ($lang2pref[$a] < $lang2pref[$b])
                return 1;
            elseif (strlen($a) > strlen($b))
                return -1;
            elseif (strlen($a) < strlen($b))
                return 1;
            else
                return 0;
        };

        // sort the languages by prefered language and by the most specific region
        uksort($lang2pref, $cmpLangs);

        $tokens = array_keys($lang2pref);
        $current = array_shift($tokens);
        
        if (strlen($current) !== strlen($default)) {
            return ($default !== null) ? $default : $current;
        }
        
        return $current;
    }
296850
public function get(string $key, $default = null)
    {
        $value = Arr::get($this->items, $key);

        if (\is_null($value)) {
            return \value($default);
        }

        return $value;
    }
46575
public function getDefaultUrl($language = null)
    {
        foreach ($this->urls as $url) {
            if ($url->isDefault()) {
                return $url;
            }
        }

        return null;
    }
436284
public function get($key, $default = null)
    {
        if (array_key_exists($key, $this->params)) {
            return $this->params[$key];
        }

        return $default;
    }
995028
public function get($key, $default = null) {
		$this->check();
		$value = $this->readValue($key);
		return is_null($value) ? $default : $value;
	}
105956
public function setDefaultFont($default = null)
    {
        $old = $this->_defaultFont;
        $this->_defaultFont = $default;
        if ($default) $this->value['font-family'] = $default;
        return $old;
    }
372878
public static function get($key, $default = NULL) {
        if (isset(self::$configs[$key]))
            return self::$configs[$key];

        return $default;

    }
1249452
public function get( $key, $default = NULL )
	{
		if( $this->has( $key ) )
			return $this->pairs[( !$this->caseSensitive ? strtolower( $key ) : $key )];
		return $default;
	}
1250709
public function getOne($key, $default = null)
    {
        $ret = $default;
        $all = $this->get($key);
        if (count($all) > 0) {
            $ret = array_shift($all);
        }

        return $ret;
    }
342021
public function getOriginal(string $key, $default = null)
    {
        if ($this->has($key)) {
            return parent::get(Formater::normalize($key))['key'];
        }

        return $default;
    }
1225106
public function getAcceptableEncodings(?string $default = null): array
	{
		if(!isset($this->acceptableEncodings))
		{
			$this->acceptableEncodings = $this->parseAcceptHeader($this->get('accept-encoding'));
		}

		return $this->acceptableEncodings ?: (array) $default;
	}
1237997
protected function translate($key, $default = false)
    {
        $string = $this->translator->get($key);

        if ($default !== false) {
            if ($string == $key) {
                return $default;
            }
        }

        return $string;
    }
1061446
public function get($key = null, $default = null)
    {
        if ($this->has($key)) {
            return $this->getValueAtKey($key, $this->payload());
        }
        return $default;
    }
1193613
public function getDescription($default = false)
    {
        if (($ob = $this->_headers['content-description']) &&
            strlen($ob->value)) {
            return $ob->value;
        }

        return $default
            ? $this->getName()
            : '';
    }
1136222
public function getLanguageUid(int $default = null): int {
    $languageUid = $default ?: 0;

    if (TYPO3_MODE === 'FE') {
      if (isset($GLOBALS['TSFE']->sys_language_uid)) {
        $languageUid = $GLOBALS['TSFE']->sys_language_uid;
      }
    } elseif (is_object($GLOBALS['LANG'])) {
      if (isset($GLOBALS['LANG']->sys_language_uid)) {
        $languageUid = $GLOBALS['LANG']->sys_language_uid;
      }
    }

    return $languageUid;
  }
1160795
function policy($default=NULL) {
        if (!isset($default))
            return $this->policy;
        if (in_array($default=strtolower($default),array(self::ALLOW,self::DENY)))
            $this->policy=$default;
        return $this;
    }
1092498
protected function createDefaultDDL($default)
    {
        $dataType = $this->getDataType();

        if (is_array($default)) {
            foreach ($default as $k => $option) {
                $default[$k] = $this->getDataType()->quote($option);
            }
            $default = '(' . implode(',', $default) . ')';
        } elseif ($dataType instanceof TimeTypeInterface
            && $this->getDefault() == self::DEFAULT_CURRENT_TIMESTAMP
        ) {
            $precision = $dataType->hasPrecision() ? '(' . $dataType->getPrecision() . ')' : null;
            $default = self::DEFAULT_CURRENT_TIMESTAMP . $precision;
        } else {
            $default = $this->getDefault() === null ? 'NULL' : $this->getDataType()->quote($default);
        }

        return $default;
    }