Checks if two values are the same type

@param mixed $value1 The first value
@param mixed $value2 The second value

@return bool
326722
public static function areSameType($value1, $value2): bool
    {
        if (!is_object($value1) || !is_object($value2)) {
            return gettype($value1) === gettype($value2);
        }

        return get_class($value1) === get_class($value2);
    }
221154
public static function isBooleanValue($value): bool
    {
        return is_bool($value) || self::isBooleanStringValue($value) || self::isBooleanNumericValue($value);
    }
1237393
protected function compare($value1, $value2)
	{
		$haystack = [
			'y',
			'ignore_unknown',
			'stream_loop',
			'sseof',
			'itsoffset',
			'thread_queue_size',
			'seek_timestamp',
			'accurate_seek',
			'noaccurate_seek',
			'ss',
			'seek_start',
			'i',
			'input',
		
		];
		
		if (($value1 = array_search(ltrim($value1[0], '-'), $haystack, false)) !== false)
		{
			return ($value2 = array_search(ltrim($value2[0], '-'), $haystack)) !== false && $value1 > $value2 ? -1 : 1;
		}
		
		return -1;
	}
160308
function is_valid_value($value) {
        if(is_array($value)) {
            if(!$this->val_multi) {
                return false;
            }
            else {
                foreach($value as $oneval) {
                    if(!rfc2445_is_valid_value($oneval, $this->val_type)) {
                        return false;
                    }
                }
            }
            return true;
        }
        return rfc2445_is_valid_value($value, $this->val_type);
    }
126327
public function orNotBetween($column, $value1, $value2)
	{
		return $this->between($column, $value1, $value2, 'OR', true);
	}
5120
private function isValidType($value): bool
    {
        if ($this->type instanceof DataType) {
            return $this->type->isTheTypeOf($value);
        }

        return true;
    }
1060467
public function isValueValid($value) {
		return $value instanceof Type\ListItemType || $value instanceof DataType\TextType || $value instanceof Type\ThingType;
	}
468572
public boolean sameValue(Object value1, Object value2) {
    return ((BigDecimal)value1).compareTo((BigDecimal)value2) == 0;
  }
465368
public function isValueValid($value) {
		return $value instanceof Type\EnumerationType || $value instanceof Type\PropertyValueType || $value instanceof Type\QualitativeValueType || $value instanceof Type\QuantitativeValueType || $value instanceof Type\StructuredValueType;
	}
979102
private final static boolean valuesMatch(Object value1, Object value2) {
        if (value1 == null) {
            return value2 == null;
        } else {
            return value1.equals(value2);
        }
    }
408190
public function equals($type, $value = null)
    {
        return $this->is($type) && $value === $this->value;
    }
685975
protected function checkType(string $type, $value): bool
    {
        switch ($type) {
            case 'array':
                return \is_array($value);

            case 'bool':
            case 'boolean':
                return \is_bool($value);

            case 'callable':
                return \is_callable($value);

            case 'float':
            case 'double':
                return \is_float($value);

            case 'int':
            case 'integer':
                return \is_int($value);

            case 'null':
                return $value === null;

            case 'numeric':
                return \is_numeric($value);

            case 'object':
                return \is_object($value);

            case 'resource':
                return \is_resource($value);

            case 'scalar':
                return \is_scalar($value);

            case 'string':
                return \is_string($value);

            case 'mixed':
                return true;

            default:
                return ($value instanceof $type);
        }
    }
17175
public function isValueValid($value) {
		return $value instanceof Type\AudienceType || $value instanceof Type\OrganizationType || $value instanceof Type\PersonType;
	}
786816
public function isValueValidType($value)
    {
        switch ($this->getType()) {
            case self::TYPE_BOOLEAN:
                $isValid = is_bool($value);
                break;
            case self::TYPE_DATE:
            case self::TYPE_DATETIME:
                $isValid = is_object($value) and get_class($value) == 'DateTime';
                break;
            case self::TYPE_NUMBER:
                $isValid = is_numeric($value);
                break;
            case self::TYPE_STRING:
                $isValid = is_string($value);
                break;
            default:
                $isValid = false;
        }

        return $isValid;
    }
300845
public function matches($value): bool
    {
        $left = $this->value;
        $right = $value;

        if ($this->useSubstitution) {
            if ($left instanceof IterableSpy) {
                $left = $left->iterable();
            } elseif (
                $left instanceof Generator &&
                isset($left->_phonySubject)
            ) {
                $left = $left->_phonySubject;
            } elseif ($left instanceof InstanceHandle) {
                $left = $left->get();
            }

            if ($right instanceof IterableSpy) {
                $right = $right->iterable();
            } elseif (
                $right instanceof Generator &&
                isset($right->_phonySubject)
            ) {
                $right = $right->_phonySubject;
            } elseif ($right instanceof InstanceHandle) {
                $right = $right->get();
            }
        }

        /*
         * @var array<string,bool> The set of object comparisons that have been made.
         *
         * Keys are of the format "<left spl hash>:<right spl hash>"; values are
         * always TRUE. This set is used to detect comparisons that have already
         * been made in order to avoid infinite recursion when comparing cyclic
         * data structures.
         */
        $visitedObjects = [];

        /*
         * @var array<string,bool> The set of array comparisons that have been made.
         *
         * Keys are of the format "<left id>:<right id>"; values are always
         * TRUE. This set is used to detect comparisons that have already been
         * made in order to avoid infinite recursion when comparing cyclic data
         * structures.
         */
        $visitedArrays = [];

        /*
         * @var array<&array> Arrays that have been marked with an internal ID.
         *
         * In order to detect cyclic arrays we need to mark them with an ID.
         * This ID must be removed upon completion of the comparison.
         */
        $markedArrays = [];

        /*
         * @var array<&array> Stacks of values that are currently being compared.
         *
         * We maintain our own stack in order to:
         *
         *  - make fewer function calls (much faster in PHP 5.*)
         *  - avoid stack-depth limits
         *  - allow for 'continuations'
         *  - avoid unwinding when comparison fails
         *
         * Separate stacks are used for left/right to avoid construction of
         * temporary arrays.
         */
        $leftStack = [];
        $rightStack = [];

        /*
         * @var int The number of elements on the stacks.
         */
        $stackSize = 0;

        // ---------------------------------------------------------
        // This is the main entry point of the comparison algorithm.
        // ---------------------------------------------------------
        compare:

        if (is_array($left) && is_array($right)) {

            // Fetch or generate a unique ID for the left-hand-side.
            if (isset($left[self::ARRAY_ID_KEY])) {
                $leftId = $left[self::ARRAY_ID_KEY];
            } else {
                reset($left);
                $leftId = count($markedArrays) + 1;
                $left[self::ARRAY_ID_KEY] = $leftId;
                $markedArrays[] = &$left;
            }

            // Fetch or generate a unique ID for the right-hand-side.
            if (isset($right[self::ARRAY_ID_KEY])) {
                $rightId = $right[self::ARRAY_ID_KEY];
            } else {
                reset($right);
                $rightId = count($markedArrays) + 1;
                $right[self::ARRAY_ID_KEY] = $rightId;
                $markedArrays[] = &$right;
            }

            // Left and right are references to the same array.
            if ($leftId === $rightId) {
                goto pass;
            }

            $comparisonId = $leftId . ':' . $rightId;

            // These two arrays have already been compared.
            if (isset($visitedArrays[$comparisonId])) {
                goto pass;
            }

            // Record the comparison.
            $visitedArrays[$comparisonId] = true;

            // ---------------------------------
            // Compare the next array key/value.
            // ---------------------------------
            compareNextArrayElement:

            // Get the current key for each array, skipping our internal ID
            // value.
            $leftKey = key($left);
            next($left);

            if ($leftKey === self::ARRAY_ID_KEY) {
                $leftKey = key($left);
                next($left);
            }

            $rightKey = key($right);
            next($right);

            if ($rightKey === self::ARRAY_ID_KEY) {
                $rightKey = key($right);
                next($right);
            }

            // Keys can only be string|int (or null, if end of array).
            // Compare them using regular PHP comparison.
            if ($leftKey !== $rightKey) {
                return false;

            // Both keys are null, which means that both array are the same
            // length.
            } elseif (null === $leftKey) {
                goto pass;
            }

            // Push the arrays we're comparing on to the stack and start
            // comparing the values of this element.
            $leftStack[$stackSize] = &$left;
            $rightStack[$stackSize] = &$right;
            ++$stackSize;

            $left = &$left[$leftKey];
            $right = &$right[$rightKey];

            goto compare;
        }

        // Objects and other non-arrays can be compared with ===, as it will
        // not recurse in either case.
        if ($left === $right) {
            goto pass;
        }

        // Non-objects are not identical.
        if (!is_object($left) || !is_object($right)) {
            return false;
        }

        $leftClass = get_class($left);
        $rightClass = get_class($right);

        // The class names do not match.
        if ($leftClass !== $rightClass) {
            return false;
        }

        $comparisonId = spl_object_hash($left) . ':' . spl_object_hash($right);

        // These two objects have already been compared.
        if (isset($visitedObjects[$comparisonId])) {
            goto pass;
        }

        // Record the comparison.
        $visitedObjects[$comparisonId] = true;

        /*
         * Cast the objects as arrays and start comparing them.
         *
         * Importantly, the array cast operator maintains private and protected
         * properties, as well as arbitrary properties added to the object after
         * construction.
         *
         * Some special properties are removed for the purposes of comparison.
         *
         * @see https://github.com/php/php-src/commit/5721132
         */

        $leftIsMock = $left instanceof Mock;
        $leftIsException = $left instanceof Throwable;

        $left = (array) $left;
        unset($left["\0gcdata"]);

        if ($leftIsMock) {
            $handleProperty = "\0" . $leftClass . "\0_handle";

            if ($left[$handleProperty]) {
                $left['phony.label'] = $left[$handleProperty]->label();
            }

            unset($left[$handleProperty]);
        }

        if ($leftIsException) {
            unset(
                $left["\0*\0file"],
                $left["\0*\0line"],
                $left["\0Exception\0trace"],
                $left["\0Exception\0string"],
                $left['xdebug_message']
            );
        }

        $rightIsMock = $right instanceof Mock;
        $rightIsException = $right instanceof Throwable;

        $right = (array) $right;
        unset($right["\0gcdata"]);

        if ($rightIsMock) {
            $handleProperty = "\0" . $rightClass . "\0_handle";

            if ($right[$handleProperty]) {
                $right['phony.label'] = $right[$handleProperty]->label();
            }

            unset($right[$handleProperty]);
        }

        if ($rightIsException) {
            unset(
                $right["\0*\0file"],
                $right["\0*\0line"],
                $right["\0Exception\0trace"],
                $right["\0Exception\0string"],
                $right['xdebug_message']
            );
        }

        goto compareNextArrayElement;

        // -----------------------------
        // The current values are equal!
        // -----------------------------
        pass:

        // The stack is not empty, pop some values and compare again.
        if ($stackSize--) {
            $left = &$leftStack[$stackSize];
            $right = &$rightStack[$stackSize];

            goto compareNextArrayElement;
        }

        // Stack is empty, there's nothing left to compare. Clean up the
        // injected array IDs and return
        foreach ($markedArrays as &$array) {
            unset($array[self::ARRAY_ID_KEY]);
        }

        return true;
    }
1175474
private static boolean samePattern(String value1, String value2) {
        if (value1.length() == 0) {
            return value2.length() == 0;
        }
        if (value1.charAt(0) == '{') {
            return value2.length() > 0 && value2.charAt(0) == '{';
        }
        return value1.equals(value2);
    }
950210
public function isValueValid($value) {
		return $value instanceof DataType\BooleanType || $value instanceof DataType\NumberType || $value instanceof Type\StructuredValueType || $value instanceof DataType\TextType;
	}