src/BTR/RedisObjects/RedisSortedSet.php
public function offsetSet($offset, $value): void
    {
        if ($value === null) {
            $this->remove($offset);
        }
        if ($offset === null) {
            $highestInt = -1;
            $ranks      = $this->range(0, -1, false, true);
            rsort($ranks);
            foreach ($ranks as $rank) {
                if (\is_int($this->strToVal($rank))) {
                    $highestInt = $rank;
                }
            }
            $offset = $highestInt + 1;
        }

        if (\is_float($this->strToVal($value)) || \is_int($this->strToVal($value))) {
            $this->add($offset, $this->strToVal($value));
        } else {
            throw new \TypeError(
                'Illegal value type "' . gettype($value) .
                '". Sorted sets have to have a value of type float or int.'
            );
        }
    }
public function offsetSet($offset, $value): void
    {
        if ($value === null) {
            $this->remove($offset);
        }
        if ($offset === null) {
            $highestInt = -1;
            $ranks      = $this->range(0, -1, false, true);
            rsort($ranks);
            foreach ($ranks as $rank) {
                if (\is_int($this->strToVal($rank))) {
                    $highestInt = $rank;
                }
            }
            $offset = $highestInt + 1;
        }

        if (\is_float($this->strToVal($value)) || \is_int($this->strToVal($value))) {
            $this->add($offset, $this->strToVal($value));
        } else {
            throw new \TypeError(
                'Illegal value type "' . gettype($value) .
                '". Sorted sets have to have a value of type float or int.'
            );
        }
    }
public function offsetSet ( $ offset , $ value ) : void { if ( $ value === null ) { $ this -> remove ( $ offset ) ; } if ( $ offset === null ) { $ highestInt = - 1 ; $ ranks = $ this -> range ( 0 , - 1 , false , true ) ; rsort ( $ ranks ) ; foreach ( $ ranks as $ rank ) { if ( \ is_int ( $ this -> strToVal ( $ rank ) ) ) { $ highestInt = $ rank ; } } $ offset = $ highestInt + 1 ; } if ( \ is_float ( $ this -> strToVal ( $ value ) ) || \ is_int ( $ this -> strToVal ( $ value ) ) ) { $ this -> add ( $ offset , $ this -> strToVal ( $ value ) ) ; } else { throw new \ TypeError ( 'Illegal value type "' . gettype ( $ value ) . '". Sorted sets have to have a value of type float or int.' ) ; } }
{@inheritDoc}
@throws \TypeError
{