PHP 8.2.31
Preview: FallbackExecutor.php Size: 1.71 KB
/opt/cpanel/ea-wappspector/vendor/rector/rector/vendor/react/dns/src/Query/FallbackExecutor.php

<?php

namespace RectorPrefix202411\React\Dns\Query;

use RectorPrefix202411\React\Promise\Promise;
final class FallbackExecutor implements ExecutorInterface
{
    private $executor;
    private $fallback;
    public function __construct(ExecutorInterface $executor, ExecutorInterface $fallback)
    {
        $this->executor = $executor;
        $this->fallback = $fallback;
    }
    public function query(Query $query)
    {
        $cancelled = \false;
        $fallback = $this->fallback;
        $promise = $this->executor->query($query);
        return new Promise(function ($resolve, $reject) use(&$promise, $fallback, $query, &$cancelled) {
            $promise->then($resolve, function (\Exception $e1) use($fallback, $query, $resolve, $reject, &$cancelled, &$promise) {
                // reject if primary resolution rejected due to cancellation
                if ($cancelled) {
                    $reject($e1);
                    return;
                }
                // start fallback query if primary query rejected
                $promise = $fallback->query($query)->then($resolve, function (\Exception $e2) use($e1, $reject) {
                    $append = $e2->getMessage();
                    if (($pos = \strpos($append, ':')) !== \false) {
                        $append = \substr($append, $pos + 2);
                    }
                    // reject with combined error message if both queries fail
                    $reject(new \RuntimeException($e1->getMessage() . '. ' . $append));
                });
            });
        }, function () use(&$promise, &$cancelled) {
            // cancel pending query (primary or fallback)
            $cancelled = \true;
            $promise->cancel();
        });
    }
}

Directory Contents

Dirs: 0 × Files: 13

Name Size Perms Modified Actions
2.58 KB lrw-r--r-- 2024-11-08 13:59:10
Edit Download
118 B lrw-r--r-- 2024-11-08 13:59:10
Edit Download
3.38 KB lrw-r--r-- 2024-11-08 13:59:10
Edit Download
1.45 KB lrw-r--r-- 2024-11-08 13:59:10
Edit Download
1.71 KB lrw-r--r-- 2024-11-08 13:59:10
Edit Download
3.00 KB lrw-r--r-- 2024-11-08 13:59:10
Edit Download
2.01 KB lrw-r--r-- 2024-11-08 13:59:10
Edit Download
2.57 KB lrw-r--r-- 2024-11-08 13:59:10
Edit Download
3.01 KB lrw-r--r-- 2024-11-08 13:59:10
Edit Download
13.64 KB lrw-r--r-- 2024-11-08 13:59:10
Edit Download
106 B lrw-r--r-- 2024-11-08 13:59:10
Edit Download
2.74 KB lrw-r--r-- 2024-11-08 13:59:10
Edit Download
8.33 KB lrw-r--r-- 2024-11-08 13:59:10
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).