src/Fillet/Writer/PostWriter.php
public function write($data)
    {
        $post_date_string = $data['post_date']->format('Y-m-d H:i:s');
        $slug = $this->generateSlug($data['title']);
        $filename = $data['post_date']->format('Y-m-d') . '-' . $slug;

		$headerData = [
			'title' => $data['title'],
			'date' => $post_date_string,
			'layout' => 'post',
			'slug' => $slug,
			'categories' => $data['categories'],
			'tags' => $data['tags'],
		];

		$dumper = new YamlDumper();
		$header = '---' . PHP_EOL . $dumper->dump($headerData, 2) . '---' . PHP_EOL;

        $filename = $this->destinationFolder . $filename;
        if ($this->isMarkdownEnabled()) {
            $filename .= '.md';
            $data['content'] = $this->toMarkdown($data['content']);
        } else {
            $filename .= '.html';
        }
        file_put_contents($filename, $header . PHP_EOL . $data['content']);
    }
public function write($data)
    {
        $post_date_string = $data['post_date']->format('Y-m-d H:i:s');
        $slug = $this->generateSlug($data['title']);
        $filename = $data['post_date']->format('Y-m-d') . '-' . $slug;

		$headerData = [
			'title' => $data['title'],
			'date' => $post_date_string,
			'layout' => 'post',
			'slug' => $slug,
			'categories' => $data['categories'],
			'tags' => $data['tags'],
		];

		$dumper = new YamlDumper();
		$header = '---' . PHP_EOL . $dumper->dump($headerData, 2) . '---' . PHP_EOL;

        $filename = $this->destinationFolder . $filename;
        if ($this->isMarkdownEnabled()) {
            $filename .= '.md';
            $data['content'] = $this->toMarkdown($data['content']);
        } else {
            $filename .= '.html';
        }
        file_put_contents($filename, $header . PHP_EOL . $data['content']);
    }
public function write ( $ data ) { $ post_date_string = $ data [ 'post_date' ] -> format ( 'Y-m-d H:i:s' ) ; $ slug = $ this -> generateSlug ( $ data [ 'title' ] ) ; $ filename = $ data [ 'post_date' ] -> format ( 'Y-m-d' ) . '-' . $ slug ; $ headerData = [ 'title' => $ data [ 'title' ] , 'date' => $ post_date_string , 'layout' => 'post' , 'slug' => $ slug , 'categories' => $ data [ 'categories' ] , 'tags' => $ data [ 'tags' ] , ] ; $ dumper = new YamlDumper ( ) ; $ header = '---' . PHP_EOL . $ dumper -> dump ( $ headerData , 2 ) . '---' . PHP_EOL ; $ filename = $ this -> destinationFolder . $ filename ; if ( $ this -> isMarkdownEnabled ( ) ) { $ filename .= '.md' ; $ data [ 'content' ] = $ this -> toMarkdown ( $ data [ 'content' ] ) ; } else { $ filename .= '.html' ; } file_put_contents ( $ filename , $ header . PHP_EOL . $ data [ 'content' ] ) ; }
Write out a set of data into a file

@param array $data Data to use for constructing the page
Write out a set of data into a file