protected function getShardIdFromToken($token) { $result = preg_match('/:?S=(s[0-9]+):?/', $token, $matches); if ($result === 1 && array_key_exists(1, $matches)) { return $matches[1]; } return null; }