public function rename($from, $to)
    {
        $arrayCopy = $this->getInternalValue();

        if (!array_key_exists($from, $arrayCopy)) {
            throw new CollectionException(sprintf('The key "%s" was not found.', $from));
        }

        $keys = array_keys($arrayCopy);
        $keys[array_search($from, $keys)] = $to;

        $this->setInternalValue(array_combine($keys, $arrayCopy));

        return $this;
    }
public function rename($from, $to)
    {
        $arrayCopy = $this->getInternalValue();

        if (!array_key_exists($from, $arrayCopy)) {
            throw new CollectionException(sprintf('The key "%s" was not found.', $from));
        }

        $keys = array_keys($arrayCopy);
        $keys[array_search($from, $keys)] = $to;

        $this->setInternalValue(array_combine($keys, $arrayCopy));

        return $this;
    }
public function rename ( $ from , $ to ) { $ arrayCopy = $ this -> getInternalValue ( ) ; if ( ! array_key_exists ( $ from , $ arrayCopy ) ) { throw new CollectionException ( sprintf ( 'The key "%s" was not found.' , $ from ) ) ; } $ keys = array_keys ( $ arrayCopy ) ; $ keys [ array_search ( $ from , $ keys ) ] = $ to ; $ this -> setInternalValue ( array_combine ( $ keys , $ arrayCopy ) ) ; return $ this ; }
Modify the collection with the value of a key renamed by a new one

@param mixed $from
@param mixed $to

@return $this

@throws CollectionException
Modify the collection with the value of a key renamed by a new one