public function write($file)
    {
        $content = '';
        if ($this->section) {
            $content .= "[{$this->section}]\n";
        }

        foreach ($this->data as $key => $value) {
            if (is_array($value)) {
                $content .= $this->createArrayLines($value, $key);
                continue;
            }

            $content .= $this->createPropertyLine($key, $value);
        }

        if (file_put_contents($file, $content) === false) {
            throw new RuntimeException('Failed to write config file: ' . $file);
        }

        return $this;
    }