# responsive-menu/3.0.14/src/app/Filesystem/FileCreator.php

Responsive Menu – Create Mobile-Friendly Menu, version 3.0.14. 23 lines.

- Page: https://pluginprobe.com/plugins/responsive-menu/3.0.14/code/src/app/Filesystem/FileCreator.php
- Raw: https://pluginprobe.com/plugins/responsive-menu/3.0.14/raw/src/app/Filesystem/FileCreator.php
- Modified: 2016-08-20T23:47:42+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/responsive-menu/3.0.14/code/src/app/Filesystem/FileCreator.php#L10-L20`.

```php
<?php

namespace ResponsiveMenu\Filesystem;

class FileCreator {

  public function create($folder, $file_name, $content) {
    return $this->open_write_and_close($folder . '/' . $file_name, $content);
  }

  protected function open_write_and_close($file_name, $data) {
    try{
      $file = fopen($file_name, 'w');
      fwrite($file, $data);
      fclose($file);
      return true;
    } catch(\Exception $e) {
      return false;
    }
  }

}

```
