WriteInterface.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Filesystem\File;
  7. /**
  8. * @api
  9. * @since 100.0.2
  10. */
  11. interface WriteInterface extends ReadInterface
  12. {
  13. /**
  14. * Writes the data to file.
  15. *
  16. * @param string $data
  17. * @return int
  18. * @throws \Magento\Framework\Exception\FileSystemException
  19. */
  20. public function write($data);
  21. /**
  22. * Writes one CSV row to the file.
  23. *
  24. * @param array $data
  25. * @param string $delimiter
  26. * @param string $enclosure
  27. * @return int
  28. * @throws \Magento\Framework\Exception\FileSystemException
  29. */
  30. public function writeCsv(array $data, $delimiter = ',', $enclosure = '"');
  31. /**
  32. * Flushes the output.
  33. *
  34. * @return bool
  35. * @throws \Magento\Framework\Exception\FileSystemException
  36. */
  37. public function flush();
  38. /**
  39. * Portable advisory file locking
  40. *
  41. * @param int $lockMode
  42. * @return bool
  43. */
  44. public function lock($lockMode = \LOCK_EX);
  45. /**
  46. * File unlocking
  47. *
  48. * @return bool
  49. */
  50. public function unlock();
  51. }