protected function arrayEquals(array $left, $right)
    {
        if (!is_array($right)) {
            return false;
        }
        if (array_keys($left) !== array_keys($right)) {
            return false;
        }

        foreach ($left as $key => $value) {
            if (!$this->valueEquals($value, $right[$key])) {
                return false;
            }
        }

        return true;
    }