public function getThreadIdFromUrl($url)
{
$format = ':int<thread_id,title>/:page';
$suffix = substr($url, strpos($url, 'threads/') + 8);
$matchRegex = $this->router()->generateMatchRegexInner($format, '#');
if (!preg_match('#^' . $matchRegex . '#i', $suffix, $textMatch))
{
return false;
}
$matchText = $textMatch[0];
$trail = substr($suffix, strlen($matchText));
$action = isset($textMatch['_action']) ? $textMatch['_action'] : '';
$params = [];
unset($textMatch['_action']);
foreach ($textMatch AS $key => $value)
{
if (is_string($key) && strlen($value))
{
$params[$key] = $value;
}
}
return isset($params['thread_id']) ? (int)$params['thread_id'] : null;
}