Apply fixes from StyleCI
This commit is contained in:
parent
b0ff129e6f
commit
71a3cc3add
@ -93,8 +93,8 @@ class PrimeModule
|
|||||||
|
|
||||||
\danog\MadelineProto\Logger::log(['Trying to use the wolfram alpha factorization module'], \danog\MadelineProto\Logger::VERBOSE);
|
\danog\MadelineProto\Logger::log(['Trying to use the wolfram alpha factorization module'], \danog\MadelineProto\Logger::VERBOSE);
|
||||||
try {
|
try {
|
||||||
$query = 'Do prime factorization of '.$pqstr;
|
$query = 'Do prime factorization of '.$pqstr;
|
||||||
$params = [
|
$params = [
|
||||||
'async' => true,
|
'async' => true,
|
||||||
'banners' => 'raw',
|
'banners' => 'raw',
|
||||||
'debuggingdata' => false,
|
'debuggingdata' => false,
|
||||||
@ -104,24 +104,24 @@ class PrimeModule
|
|||||||
'output' => 'JSON',
|
'output' => 'JSON',
|
||||||
'proxycode' => json_decode(file_get_contents('http://www.wolframalpha.com/api/v1/code'), true)['code'],
|
'proxycode' => json_decode(file_get_contents('http://www.wolframalpha.com/api/v1/code'), true)['code'],
|
||||||
];
|
];
|
||||||
$url = 'https://www.wolframalpha.com/input/json.jsp?'.http_build_query($params);
|
$url = 'https://www.wolframalpha.com/input/json.jsp?'.http_build_query($params);
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Referer: https://www.wolframalpha.com/input/?i='.urlencode($query)]);
|
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Referer: https://www.wolframalpha.com/input/?i='.urlencode($query)]);
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
$res = json_decode(curl_exec($ch), true);
|
$res = json_decode(curl_exec($ch), true);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
foreach ($res['queryresult']['pods'] as $cur) {
|
foreach ($res['queryresult']['pods'] as $cur) {
|
||||||
if ($cur['id'] === 'Divisors') {
|
if ($cur['id'] === 'Divisors') {
|
||||||
$res = explode(', ', preg_replace(["/{\d+, /", "/, \d+}$/"], '', $cur['subpods'][0]['moutput']));
|
$res = explode(', ', preg_replace(["/{\d+, /", "/, \d+}$/"], '', $cur['subpods'][0]['moutput']));
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if (count($res) === 2) {
|
||||||
if (count($res) === 2) {
|
return $res;
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
} catch (Exception $e) {
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
}
|
||||||
|
|
||||||
\danog\MadelineProto\Logger::log(['Trying to use the native factorization module'], \danog\MadelineProto\Logger::VERBOSE);
|
\danog\MadelineProto\Logger::log(['Trying to use the native factorization module'], \danog\MadelineProto\Logger::VERBOSE);
|
||||||
$res = $this->find_small_multiplier_lopatin((int) $pqstr);
|
$res = $this->find_small_multiplier_lopatin((int) $pqstr);
|
||||||
|
Loading…
Reference in New Issue
Block a user