private function replace(
        ColumnMetadata $columnMetadata,
        string $searchTerm,
        string $replaceTerm,
        string $subject
    ): FieldReplaceResult {
        $fieldReplaced = null;
        foreach ($this->replacementStrategyList as $replacementStrategy) {
            if ($replacementStrategy->canReplace($searchTerm, $subject)) {
                $fieldReplaced = $replacementStrategy->replace(
                    $columnMetadata,
                    $searchTerm,
                    $replaceTerm,
                    $subject
                );
                break;
            }
        }

        if (is_null($fieldReplaced)) {
            throw new \RuntimeException('Error trying to replace "' . $searchTerm . '" with "' . $replaceTerm . '"');
        }

        return $fieldReplaced;
    }
private function replace(
        ColumnMetadata $columnMetadata,
        string $searchTerm,
        string $replaceTerm,
        string $subject
    ): FieldReplaceResult {
        $fieldReplaced = null;
        foreach ($this->replacementStrategyList as $replacementStrategy) {
            if ($replacementStrategy->canReplace($searchTerm, $subject)) {
                $fieldReplaced = $replacementStrategy->replace(
                    $columnMetadata,
                    $searchTerm,
                    $replaceTerm,
                    $subject
                );
                break;
            }
        }

        if (is_null($fieldReplaced)) {
            throw new \RuntimeException('Error trying to replace "' . $searchTerm . '" with "' . $replaceTerm . '"');
        }

        return $fieldReplaced;
    }
private function replace ( ColumnMetadata $ columnMetadata , string $ searchTerm , string $ replaceTerm , string $ subject ) : FieldReplaceResult { $ fieldReplaced = null ; foreach ( $ this -> replacementStrategyList as $ replacementStrategy ) { if ( $ replacementStrategy -> canReplace ( $ searchTerm , $ subject ) ) { $ fieldReplaced = $ replacementStrategy -> replace ( $ columnMetadata , $ searchTerm , $ replaceTerm , $ subject ) ; break ; } } if ( is_null ( $ fieldReplaced ) ) { throw new \ RuntimeException ( 'Error trying to replace "' . $ searchTerm . '" with "' . $ replaceTerm . '"' ) ; } return $ fieldReplaced ; }
Perform the string replacement on the field.

@throws \RuntimeException If the replacement fails.
Perform the string replacement on the field .