Example.php 996 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * This file is part of vfsStream.
  4. *
  5. * For the full copyright and license information, please view the LICENSE
  6. * file that was distributed with this source code.
  7. *
  8. * @package org\bovigo\vfs
  9. */
  10. namespace org\bovigo\vfs\example;
  11. /**
  12. * Example class.
  13. */
  14. class Example
  15. {
  16. /**
  17. * id of the example
  18. *
  19. * @type string
  20. */
  21. protected $id;
  22. /**
  23. * a directory where we do something..
  24. *
  25. * @type string
  26. */
  27. protected $directory;
  28. /**
  29. * constructor
  30. *
  31. * @param string $id
  32. */
  33. public function __construct($id)
  34. {
  35. $this->id = $id;
  36. }
  37. /**
  38. * sets the directory
  39. *
  40. * @param string $directory
  41. */
  42. public function setDirectory($directory)
  43. {
  44. $this->directory = $directory . DIRECTORY_SEPARATOR . $this->id;
  45. if (file_exists($this->directory) === false) {
  46. mkdir($this->directory, 0700, true);
  47. }
  48. }
  49. // more source code here...
  50. }
  51. ?>