/** * @param string $variableName * @param string $value */ public function replaceValue($variableName, $value) { $variableDeclaration = $variableName . '=\'' . $value . '\''; if (null === $this->getValue($variableName)) { $contents = $this->fileManipulator->read() . PHP_EOL . $variableDeclaration; } else { $contents = preg_replace($this->getVariablePattern($variableName), $variableDeclaration, $this->fileManipulator->read()); } $this->fileManipulator->write($contents); }