public function change($key, $value, $backup = true)
    {
        $yaml = $this->lines->join("\n");

        $pattern = '/^' . str_replace('/', ':.*?', $key) . '(:\s*)/mis';
        preg_match($pattern, $yaml, $matches, PREG_OFFSET_CAPTURE);
        if (!$matches) {
            // Throw exception by default in v4.0 instead of returning boolean.
            if (func_num_args() === 4 && func_get_arg(3)) {
                throw new \InvalidArgumentException(sprintf("The key '%s' was not found in %s.", $key, $this->file->getFullPath()));
            }

            return false;
        }

        $column = $matches[1][1] + strlen($matches[1][0]);
        $line = substr_count($yaml, "\n", 0, $column);

        $this->lines[$line] = preg_replace('/^(.*?):(.*(?= #)|.*$)/', '$1: ' . Inline::dump($value), $this->lines[$line]);

        $this->save($backup);

        return true;
    }