Skip to content

Commit

Permalink
Optimize namespace using
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed Oct 14, 2024
1 parent f7c16a7 commit 5edb097
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/core/Curl/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

namespace Swoole\Curl;

use Swoole;
use Swoole\Constant;
use Swoole\Coroutine\Http\Client;
use Swoole\Coroutine\System;
use Swoole\Curl\Exception as CurlException;
use Swoole\Http\Status;

Expand Down Expand Up @@ -717,7 +717,7 @@ private function execute()
}

if (!filter_var($proxy, FILTER_VALIDATE_IP)) {
$ip = Swoole\Coroutine::gethostbyname($proxy, AF_INET, $this->clientOptions['connect_timeout'] ?? -1);
$ip = System::gethostbyname($proxy, AF_INET, $this->clientOptions['connect_timeout'] ?? -1);
if (!$ip) {
$this->setError(CURLE_COULDNT_RESOLVE_PROXY, 'Could not resolve proxy: ' . $proxy);
return false;
Expand Down
6 changes: 4 additions & 2 deletions src/std/exec.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@

declare(strict_types=1);

use Swoole\Coroutine\System;

function swoole_exec(string $command, &$output = null, &$returnVar = null)
{
$result = Swoole\Coroutine::exec($command);
$result = System::exec($command);
if ($result) {
$outputList = explode(PHP_EOL, $result['output']);
foreach ($outputList as &$value) {
Expand All @@ -34,7 +36,7 @@ function swoole_exec(string $command, &$output = null, &$returnVar = null)

function swoole_shell_exec(string $cmd)
{
$result = Swoole\Coroutine::exec($cmd);
$result = System::exec($cmd);
if ($result && $result['output'] !== '') {
return $result['output'];
}
Expand Down

0 comments on commit 5edb097

Please sign in to comment.