symfony/symfony — pull request #4946 by romainneutron (2012-07-16 22:09:45+00:00)
Title: Add bookFile and getTemporayFiles methods

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes [![Build Status](https://secure.travis-ci.org/romainneutron/symfony.png?branch=TemporaryFiles)](http://travis-ci.org/romainneutron/symfony)
Todo: write documentation
License of the code: MIT

---

``Filesystem::bookFile``
bookFile should be used to get an empty new file in a specified directory :

example :
This creates a new file in "/datas/store" which will have a name matching `image\w{5}_thumb.jpg` :
```php
bookFile('/datas/store', 'image', '_thumb', 'jpg');
```

basic usage only requires the target folder :
```php
bookFile('./datas');
```
---

``Filesystem::getTemporaryFiles``
getTemporaryFiles should be used to get a set of empty new temporary files

example :
This create 5 temporary files with the prefix "image", the suffix "preview" and the extension "png" :
```php
getTemporaryFiles(5, 'image', 'preview', 'png');
```

basic usage only requires the number of requested files :
```php
getTemporaryFiles(12);
```