Началр работы с переработкой
This commit is contained in:
36
sources/API/Traits/Request.php
Normal file
36
sources/API/Traits/Request.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace VK\API\Traits;
|
||||
|
||||
use VK\Browsers\BrowserAbstract;
|
||||
use Exception;
|
||||
/**
|
||||
* Паттерн registry
|
||||
*/
|
||||
trait Request
|
||||
{
|
||||
private static function request(string $method, array $params, BrowserAbstract $browser)
|
||||
{
|
||||
$url = 'https://api.vk.com/method/' . $method;
|
||||
|
||||
foreach ($params as $key => $value) {
|
||||
$post[$key] = $value;
|
||||
}
|
||||
|
||||
// while (True) {
|
||||
// try {
|
||||
return $browser::post($url, $post);
|
||||
// } catch (Exception $e) {
|
||||
// // if (in_array($e->getCode(), $this->request_ignore_error)) {
|
||||
// // sleep(1);
|
||||
// // continue;
|
||||
// // } else
|
||||
// // throw new Exception($e->getMessage(), $e->getCode());
|
||||
// throw new Exception('Жопа');
|
||||
// }
|
||||
// }
|
||||
return false;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user