ProtectedDirectory.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. namespace Drupal\Core\File;
  3. /**
  4. * A value object representing a protected directory.
  5. */
  6. class ProtectedDirectory {
  7. /**
  8. * The directory title.
  9. *
  10. * @var string
  11. */
  12. protected $title;
  13. /**
  14. * The directory path.
  15. *
  16. * @var string
  17. */
  18. protected $path;
  19. /**
  20. * If the directory is private (or public).
  21. *
  22. * @var bool
  23. */
  24. protected $private;
  25. /**
  26. * ProtectedDirectory constructor.
  27. *
  28. * @param string $title
  29. * The directory title.
  30. * @param string $path
  31. * The path to the directory.
  32. * @param bool $private
  33. * (optional) Whether the directory is private or public (default).
  34. */
  35. public function __construct($title, $path, $private = FALSE) {
  36. $this->title = $title;
  37. $this->path = $path;
  38. $this->private = $private;
  39. }
  40. /**
  41. * Gets the title.
  42. *
  43. * @return string
  44. * The Title.
  45. */
  46. public function getTitle() {
  47. return $this->title;
  48. }
  49. /**
  50. * Gets the directory path.
  51. *
  52. * @return string
  53. * The directory path.
  54. */
  55. public function getPath() {
  56. return $this->path;
  57. }
  58. /**
  59. * Is the directory private (or public).
  60. *
  61. * @return bool
  62. * TRUE if the directory is private, FALSE if it is public.
  63. */
  64. public function isPrivate() {
  65. return $this->private;
  66. }
  67. }