public function offsetSet($index, $value)
    {
        if (!($value instanceof Translation)) {
            throw new InvalidArgumentException(
                'Only instances of Gettext\\Translation must be added to a Gettext\\Translations'
            );
        }

        $id = $value->getId();

        if ($this->offsetExists($id)) {
            $this[$id]->mergeWith($value);

            return $this[$id];
        }

        parent::offsetSet($id, $value);

        return $value;
    }
public function offsetSet($index, $value)
    {
        if (!($value instanceof Translation)) {
            throw new InvalidArgumentException(
                'Only instances of Gettext\\Translation must be added to a Gettext\\Translations'
            );
        }

        $id = $value->getId();

        if ($this->offsetExists($id)) {
            $this[$id]->mergeWith($value);

            return $this[$id];
        }

        parent::offsetSet($id, $value);

        return $value;
    }
public function offsetSet ( $ index , $ value ) { if ( ! ( $ value instanceof Translation ) ) { throw new InvalidArgumentException ( 'Only instances of Gettext\\Translation must be added to a Gettext\\Translations' ) ; } $ id = $ value -> getId ( ) ; if ( $ this -> offsetExists ( $ id ) ) { $ this [ $ id ] -> mergeWith ( $ value ) ; return $ this [ $ id ] ; } parent :: offsetSet ( $ id , $ value ) ; return $ value ; }
Control the new translations added.

@param mixed       $index
@param Translation $value

@throws InvalidArgumentException If the value is not an instance of Gettext\Translation

@return Translation
Control the new translations added .