private function changeValueInYaml($value)
    {
        $originalVal = $this->getCurrentData();

        $endValuePosition = $this->findEndPositionOfValue($originalVal);

        $newYamlValue = $this->convertToYaml($value);
        if (!\is_array($originalVal) && \is_array($value)) {
            // we're converting from a scalar to a (multiline) array
            // this means we need to break onto the next line

            // increase the indentation
            $this->manuallyIncrementIndentation();
            $newYamlValue = "\n".$this->indentMultilineYamlArray($newYamlValue);
        } else {
            // empty space between key & value
            $newYamlValue = ' '.$newYamlValue;
        }
        $newContents = substr($this->contents, 0, $this->currentPosition)
            .$newYamlValue
            .substr($this->contents, $endValuePosition);

        $newPosition = $this->currentPosition + \strlen($newYamlValue);

        $newData = $this->currentData;
        $newData = $this->setValueAtCurrentPath($value, $newData);

        $this->updateContents(
            $newContents,
            $newData,
            $newPosition
        );
    }
private function changeValueInYaml($value)
    {
        $originalVal = $this->getCurrentData();

        $endValuePosition = $this->findEndPositionOfValue($originalVal);

        $newYamlValue = $this->convertToYaml($value);
        if (!\is_array($originalVal) && \is_array($value)) {
            // we're converting from a scalar to a (multiline) array
            // this means we need to break onto the next line

            // increase the indentation
            $this->manuallyIncrementIndentation();
            $newYamlValue = "\n".$this->indentMultilineYamlArray($newYamlValue);
        } else {
            // empty space between key & value
            $newYamlValue = ' '.$newYamlValue;
        }
        $newContents = substr($this->contents, 0, $this->currentPosition)
            .$newYamlValue
            .substr($this->contents, $endValuePosition);

        $newPosition = $this->currentPosition + \strlen($newYamlValue);

        $newData = $this->currentData;
        $newData = $this->setValueAtCurrentPath($value, $newData);

        $this->updateContents(
            $newContents,
            $newData,
            $newPosition
        );
    }
private function changeValueInYaml ( $ value ) { $ originalVal = $ this -> getCurrentData ( ) ; $ endValuePosition = $ this -> findEndPositionOfValue ( $ originalVal ) ; $ newYamlValue = $ this -> convertToYaml ( $ value ) ; if ( ! \ is_array ( $ originalVal ) && \ is_array ( $ value ) ) { // we're converting from a scalar to a (multiline) array // this means we need to break onto the next line // increase the indentation $ this -> manuallyIncrementIndentation ( ) ; $ newYamlValue = "\n" . $ this -> indentMultilineYamlArray ( $ newYamlValue ) ; } else { // empty space between key & value $ newYamlValue = ' ' . $ newYamlValue ; } $ newContents = substr ( $ this -> contents , 0 , $ this -> currentPosition ) . $ newYamlValue . substr ( $ this -> contents , $ endValuePosition ) ; $ newPosition = $ this -> currentPosition + \ strlen ( $ newYamlValue ) ; $ newData = $ this -> currentData ; $ newData = $ this -> setValueAtCurrentPath ( $ value , $ newData ) ; $ this -> updateContents ( $ newContents , $ newData , $ newPosition ) ; }
Replaces the value at the current position with this value.

The position should be set right at the start of this value
(i.e. after its key).

@param mixed $value The new value to set into YAML
Replaces the value at the current position with this value .