Skip to content

Commit

Permalink
Add append option; update docblocks
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Jan 23, 2016
1 parent 4897375 commit cc6c3cf
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ function create()
}

/**
* @coroutine
*
* @param string $path
*
* @return \Generator
Expand All @@ -61,19 +63,22 @@ function get($path)
}

/**
* @coroutine
*
* @param string $path
* @param string $data
* @param bool $append
*
* @return \Generator
*
* @resolve int Number of bytes written.
*
* @throws \Icicle\File\Exception\FileException
*/
function put($path, $data)
function put($path, $data, $append = false)
{
/** @var \Icicle\File\File $file */
$file = (yield driver()->open($path, 'w'));
$file = (yield driver()->open($path, $append ? 'a' : 'w'));

$written = (yield $file->write($data));

Expand Down

0 comments on commit cc6c3cf

Please sign in to comment.