Automattic\WooCommerce\Vendor\GraphQL\Utils

PairSet::haspublicWC 1.0

Method of the class: PairSet{}

No Hooks.

Returns

null. Nothing (null).

Usage

$PairSet = new PairSet();
$PairSet->has( $a, $b, $areMutuallyExclusive ): bool;
$a(string) (required)
.
$b(string) (required)
.
$areMutuallyExclusive(true|false) (required)
.

PairSet::has() code WC 10.9.1

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;
}