Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/webonyx/graphql-php/src/Utils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/webonyx/graphql-php/src/Utils/PairSet.php
<?php declare(strict_types=1);

namespace GraphQL\Utils;

/**
 * A way to keep track of pairs of things when the ordering of the pair does
 * not matter. We do this by maintaining a sort of double adjacency sets.
 */
class PairSet
{
    /** @var array<string, array<string, bool>> */
    private array $data = [];

    public function has(string $a, string $b, bool $areMutuallyExclusive): bool
    {
        $first = $this->data[$a] ?? null;
        $result = $first !== null && isset($first[$b]) ? $first[$b] : null;
        if ($result === null) {
            return false;
        }

        // areMutuallyExclusive being false is a superset of being true,
        // hence if we want to know if this PairSet "has" these two with no
        // exclusivity, we have to ensure it was added as such.
        if ($areMutuallyExclusive === false) {
            return $result === false;
        }

        return true;
    }

    public function add(string $a, string $b, bool $areMutuallyExclusive): void
    {
        $this->pairSetAdd($a, $b, $areMutuallyExclusive);
        $this->pairSetAdd($b, $a, $areMutuallyExclusive);
    }

    private function pairSetAdd(string $a, string $b, bool $areMutuallyExclusive): void
    {
        $this->data[$a] ??= [];
        $this->data[$a][$b] = $areMutuallyExclusive;
    }
}

Spamworldpro Mini