Replaces an existing token with a new token.

@param string $old The token you want to replace.
@param string $new The token you want to replace $old with.
@return void
550270
public function replace(string $old, string $new)
    {
        if ($old === $new) {
            return;
        }
        $this->tokenize();
        $i = array_search($old, $this->tokens);
        if ($i !== false) {
            $j = array_search($new, $this->tokens);
            if ($j === false) {
                $this->tokens[$i] = $new;
            } else {
                array_splice($this->tokens, $i, 1);
            }
            $this->setAttributeValue();
        }
    }
1175672
public function updatePassword($token, $oldPassword, $newPassword)
    {
        return $this->bizImpl->updatePassword($token, $oldPassword, $newPassword);
    }
1289236
public function lines(array $old, array $new)
    {
        $out = [];
        $newLen = count($new);
        $oldLen = count($old);
        for ($i = 0; $i < $oldLen || $i < $newLen; $i++) {
            if ($i >= $oldLen) {
                $out[] = ['col' => 0, 'str' => $new[$i]]; // write out the entire line for extra lines
            } elseif ($i >= $newLen) {
                $out[] = ['col' => 0, 'str' => '']; // clear the line if the new array has less entries than the old one
            } else {
                $col = $this->firstDifference($old[$i], $new[$i]);
                if ($col === -1) {
                    $out[] = null;
                } else {
                    $out[] = ['col' => $col, 'str' => mb_substr($new[$i], $col)];
                }
            }
        }
        return $out;
    }
1358445
private function copyNodeStats(Node $oldNode, Node $newNode)
    {
        $oldNodeJobCount = $oldNode->getTotalJobCount();
        $newNode->addJobCount($oldNodeJobCount);
    }
748424
public function rename_mbox($old, $new){
    if ( $this->is_connected() ){
      return imap_renamemailbox($this->stream, $this->mbParam. $old, $this->mbParam. $new);
    }
    return false;
  }
542120
public function replace($old, $new): self
    {
        Assert::typeOf(['string', __CLASS__], $old, $new);

        return new static(str_replace((string) $old, (string) $new, $this->data), $this->encoding);
    }
1011933
protected static function formatGroupPrefix($new, $old)
    {
        $oldPrefix = $old['prefix'] ?? null;

        if (isset($new['prefix'])) {
            return \trim($oldPrefix, '/').'/'.\trim($new['prefix'], '/');
        }

        return $oldPrefix;
    }
725102
public function rename($oldName, $newName)
	{
		$form = $this->get($oldName);
		$this->delete($oldName);
		$this->add($newName, $form['code'], $form['title']);
	}
693335
public function replace($oldValue, $newValue)
    {
        if (!is_string($oldValue)) {
            throw new UnexpectedTypeException($oldValue, 'string', 'oldValue');
        }
        if (empty($oldValue)) {
            return;
        }
        if (!is_string($newValue) && null !== $newValue) {
            throw new UnexpectedTypeException($newValue, 'string or null', 'newValue');
        }

        $key = array_search($oldValue, $this->values, true);
        if (false !== $key) {
            if (empty($newValue)) {
                unset($this->values[$key]);
            } else {
                $this->values[$key] = $newValue;
            }
        }
    }
1242080
protected function listByLines($old, $new)
    {
        /* @var $newDom \simple_html_dom */
        $newDom = HtmlDomParser::str_get_html($new);
        /* @var $oldDom \simple_html_dom */
        $oldDom = HtmlDomParser::str_get_html($old);

        $newListNode = $this->findListNode($newDom);
        $oldListNode = $this->findListNode($oldDom);

        $operations = $this->getListItemOperations($oldListNode, $newListNode);

        return $this->processOperations($operations, $oldListNode, $newListNode);
    }
909714
public static function mergeStatic($new = null, array $old = [])
    {
        // Parses the string into an associative array
        parse_str(preg_replace('/\s*([\w-]+)\s*=\s*"([^"]+)"/', '$1=$2&', $new), $attrs);

        // Merge classes
        $attrs['class'] = self::formatGroupClass($attrs, $old);

        // Merging new and old array and parse it as a string
        return self::attributes(array_merge(Arr::except($old, array('class')), $attrs));
    }
22044
protected function formatNamespace(array $new, array $old)
    {
        if (isset($new['namespace']) && isset($old['namespace'])) {
            return trim($old['namespace'], '\\').'\\'.trim($new['namespace'], '\\');
        } elseif (isset($new['namespace'])) {
            return trim($new['namespace'], '\\');
        }

        return array_get($old, 'namespace');
    }
304427
protected static function formatGroupPrefix($new, $old)
    {
        $prefix = isset($old['prefix']) ? $old['prefix'] : null;

        if (isset($new['prefix'])) {
            return trim($prefix, '/') .'/' .trim($new['prefix'], '/');
        }

        return $prefix;
    }
1305496
protected function updateEnabled( $new, $old )
    {
        $result     = array();
        $service    = $this->getServiceLocator()
                           ->get( 'Locale' );

        foreach ( $service->getAvailableFlags() as $locale => $enabled )
        {
            $result[$locale] = (string) (
                ! empty( $new[$locale] ) ||
                in_array( $locale, $new )
            );
        }

        return $result;
    }
28710
public function replaceReconstitutedEntity($oldEntity, $newEntity)
    {
        $this->reconstitutedEntities->detach($oldEntity);
        $this->reconstitutedEntities->attach($newEntity);
    }
88886
public function renameColumn($oldName, $newName)
    {
        foreach ($this->getDataTables() as $table) {
            $table->renameColumn($oldName, $newName);
        }
    }
220086
public function renameTable($oldName, $newName)
    {
        if (!$this->hasTable($oldName)) {
            throw SchemaException::schemaTableDoesNotExist($this->getName(), $oldName);
        }

        if ($this->hasTable($newName)) {
            throw SchemaException::schemaTableAlreadyExists($this->getName(), $newName);
        }

        $this->tables[$oldName]->setName($newName);
        $this->tables[$newName] = $this->tables[$oldName];

        unset($this->tables[$oldName]);
    }