if (self::MODE_DISABLED ===
$mode) { return $this->configuration = Configuration::
inDisabledMode();
} if ('weak' ===
$mode) { return $this->configuration = Configuration::
inWeakMode();
} if (isset($mode[0
]) && '/' ===
$mode[0
]) { return $this->configuration = Configuration::
fromRegex($mode);
} if (preg_match('/^[1-9][0-9]*$/',
(string) $mode)) { return $this->configuration = Configuration::
fromNumber($mode);
} if (!
$mode) { return $this->configuration = Configuration::
fromNumber(0
);
} return $this->configuration = Configuration::
fromUrlEncodedString((string) $mode);
} /**
* @param string $str
* @param bool $red
*
* @return string
*/